Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.27 KB | None | 0 0
  1. Module Module1
  2.  
  3.     Sub Main()
  4.         'Program:       Chapter 3 Contribution Program
  5.         'Programmer:    Christopher Russell
  6.         'Date:          February 20, 2011
  7.         'Description:   Calculate your bmi using height and weight.
  8.  
  9.         'Declaration
  10.         Dim decHeight As Decimal = 0
  11.         Dim decWeight As Decimal = 0
  12.         Dim decBmi As Decimal = 0
  13.  
  14.         'Input
  15.         getWeight(decWeight)
  16.         getHeight(decHeight)
  17.  
  18.  
  19.         'Output
  20.         ShowBmi(decBmi, decHeight, decWeight)
  21.         showTermination()
  22.  
  23.     End Sub
  24.     Private Sub getWeight(ByRef decWeight As Decimal)
  25.         Console.Write("Enter your weight. ")
  26.         decWeight = CDec(Console.ReadLine())
  27.     End Sub
  28.     Private Sub getHeight(ByRef decHeight As Decimal)
  29.         Console.Write("Enter your height.")
  30.         decHeight = CDec(Console.ReadLine())
  31.  
  32.     End Sub
  33.     Private Sub ShowBmi(ByRef decBmi As Decimal, ByRef decWeight As Decimal, ByRef decHeight As Decimal)
  34.         decBmi = CDec((CDec(decWeight * 703) / decHeight ^ 2))
  35.         Console.WriteLine("Your BMI is " & decBmi)
  36.  
  37.     End Sub
  38.     Private Sub showTermination()
  39.         Console.WriteLine()
  40.         Console.Write("Press the enter key to end the program.")
  41.         Console.Read()
  42.     End Sub
  43. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement