Topic: hey can someone help me with vb2008

http://pastebin.com/uD70GPr6



i'm having trouble making a program that determines the Body Mass Index of a person and also display if they are over weight or under weight i have my source written up and part of it just isn't working i am wondering if someone can help me fix it or at least help me find the problem thank you. don't be to critical i'm new to programming here's the source.


Module Module1
'Program: bmi
'Programmer: Michael Burns
'Date: 3/6/1020
'Description: calculates the bmi of a person and determines if it is normal, under, or over weight..

Dim decWeight As Decimal = 0
Dim decHight As Decimal = 0
Dim decBmi As Decimal = 0
Dim decBmi2 As Decimal = 0





Sub Main()
'Declaration


'Input
getInput(decWeight, decHight)

'Process
calculate()

'Output
display()
terminateProgram()

End Sub

Private Sub getInput(ByRef decWeight As Decimal, ByRef decHight As Decimal)
Console.Write("Enter your Weight in Pounds: ")
decWeight = CDec(Console.ReadLine())
Console.Write("Enter your Height in inches: ")
decHight = CDec(Console.ReadLine())


End Sub

Private Sub calculate()
'Declaration
Dim decBmi = decWeight * 703 / decHight ^ 2


'Determine
If decBmi >= 18.5 And decBmi <= 25 Then
decBmi2 = 1
Else
If decBmi < 18.5 Then
decBmi2 = 2
End If

End If



End Sub

Private Sub display()
Console.WriteLine()
Console.WriteLine("Your BMI is: " & decBmi)

If decBmi2 = 1 Then
Console.WriteLine()
Console.WriteLine("Your BMI is Optimal. ")
Else
If decBmi2 = 2 Then
Console.WriteLine()
Console.WriteLine("Your BMI is Under Weight. ")
Else
Console.WriteLine()
Console.WriteLine(" Your BMI is Over Weight.")
End If
End If




End Sub

Private Sub terminateProgram()
Console.WriteLine()
Console.Write("Press the enter key to end the program.")
Console.Read()

End Sub
End Module

Re: hey can someone help me with vb2008

nothing jumps out at me, but then again i don't do VB

i notice calculate() and display() doesn't have any args, but getInput() does, i don't know if thats important.
also you aren't doing an assignment on your if statements in display() are you?

other than that, i not sure, sprinkle a few print statements in, so you know that variables are what you think they should be etc, failing that post some more details of what actually isn't working.

on a stylistic note, may i suggest you don't assign decBmi2 at the end of calculate() and instead leave it til youre doing the printing in display(),
ie

If decBmi >= 18.5 And decBmi <= 25 Then
Console.WriteLine()
Console.WriteLine("Your BMI is Optimal. ")

it saves you a variable and makes it a bit more explicit what youre printing and why.

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: hey can someone help me with vb2008

Sorry, I know you were looking for some help with VB, but I just wanted to add true BMI isn't tally'd against only Weight and Height.  There are 4 critierias of measurement:

Weight
Height in inches
Waistline in inches (measurement around the belly button area)
Neck / Collar in inches

There is a BMI chart for the 4 criterias above.  The military uses it.

Re: hey can someone help me with vb2008

^ Unfortunately, most HMO's (which is what passes for health care for those who can afford it in the US) only use height & weight.  The US military system is a step in the right direction, as it attempts to include a measurement of subcutaneous fat, but still falls short of even the 3-site skinfold %bodyfat test.

Sorry Jack, we're all kinds of not helping here. hmm

while ( ! ( succeed = try() ) );