Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- 'Program: Chapter 3 Contribution Program
- 'Programmer: Christopher Russell
- 'Date: February 20, 2011
- 'Description: Calculate your bmi using height and weight.
- 'Declaration
- Dim decHeight As Decimal = 0
- Dim decWeight As Decimal = 0
- Dim decBmi As Decimal = 0
- 'Input
- getWeight(decWeight)
- getHeight(decHeight)
- 'Output
- ShowBmi(decBmi, decHeight, decWeight)
- showTermination()
- End Sub
- Private Sub getWeight(ByRef decWeight As Decimal)
- Console.Write("Enter your weight. ")
- decWeight = CDec(Console.ReadLine())
- End Sub
- Private Sub getHeight(ByRef decHeight As Decimal)
- Console.Write("Enter your height.")
- decHeight = CDec(Console.ReadLine())
- End Sub
- Private Sub ShowBmi(ByRef decBmi As Decimal, ByRef decWeight As Decimal, ByRef decHeight As Decimal)
- decBmi = CDec((CDec(decWeight * 703) / decHeight ^ 2))
- Console.WriteLine("Your BMI is " & decBmi)
- End Sub
- Private Sub showTermination()
- Console.WriteLine()
- Console.Write("Press the enter key to end the program.")
- Console.Read()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement