I'm struggling to get this code to work:
Module Module1
Function BMI(ByVal H, ByVal W)
BMI = (W / H) ^ 2
Return BMI
End Function
Function reading(ByVal BMI)
If BMI <= 19 Then
reading = "Underweight"
ElseIf BMI >= -20 <= 25 Then
reading = "Perfect"
ElseIf BMI >= 26 <= 30 Then
reading = "Slightly Overweight"
ElseIf BMI >= 31 <= 40 Then
reading = "Overweight"
ElseIf BMI >= 41 Then
reading = "Obese"
End If
Return reading
End Function
Sub Main()
Dim height, weight As Integer
Console.Write("What is your height? ")
height = Console.ReadLine
Console.Write("What is your weight? ")
weight = Console.ReadLine
BMI(height, weight)
reading(BMI)
End Sub
End Module
I'm informed that 'reading(BMI)' has an 'argument not specified for parameter 'W' of 'Public Function BMI(H As Object, W As Object) As Object.'
Please can someone help me fix this?