JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



BMI please help


D

keyboard_arrow_up
1
keyboard_arrow_down


First Post Mark as Spam Dryden Dan
Posts: 4 - Registered: 2016-08-28 22:46:11

there is something slightly off with this code please help

Sub Main()

Dim height As Double = 0.0
Dim weight As Double = 0.0
Dim BMI As Double = 0.0
Dim continue1 As Boolean = 0

displayWelcomeMessage()

continue1 = "y"

While continue1 = "y"

getInput(height, weight)
calcBMI(height, weight, BMI)
displayOutput(BMI)

Console.WriteLine("Dou you want to continue? y = yes, n = no ")
continue1 = Console.ReadLine()

End While

displayTerminationMessage()

End Sub
Sub displayWelcomeMessage()

Console.WriteLine("Welcome to the BMI Calculator")

End Sub
Sub getInput(ByRef height As Double, ByRef weight As Double)

Console.WriteLine("Please enter your height in inches ")
height = Console.ReadLine
Console.WriteLine("Please enter your height in pounds ")
weight = Console.ReadLine

End Sub
Sub calcBMI(ByRef height As Double, ByRef weight As Double, ByRef BMI As Double)

BMI = (weight * 703) / (height ^ 2)

End Sub
Sub displayTerminationMessage()

Console.WriteLine("Thank you for using the BMI calculator!")
Console.WriteLine("Please select enter to exit...")

End Sub
Sub displayOutput(ByRef BMI As Double)

Dim category As String = 0

getCategory(BMI, category)

Console.WriteLine("Your body mass index is: " & BMI)
Console.WriteLine("Your weight category is: " & category)

End Sub
Sub getCategory(ByRef BMI As Double, ByRef category As String)

If BMI < 18.5 Then
category = "ummm.... eat more"
ElseIf BMI < 25 Then
category = "don't listen to your shrink, your normal"
ElseIf BMI < 30 Then
category = "ummm.... stop eating the last piece of pizza, pie or cake"
Else
category = "time to change your diet"
End If

End Sub




D

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 Mark as Spam Dryden Dan
Posts: 4 - Registered: 2016-08-28 22:46:11

thanks I figured it out






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising