Body Mass Index programming visual basic help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • boomer
    New Member
    • Oct 2006
    • 2

    Body Mass Index programming visual basic help

    Having trouble programming for body mass index. Entering 180 lbs, 72 " ht
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    Please state the problem statement clearly. What is your formula? Is there any runtime error?

    Comment

    • boomer
      New Member
      • Oct 2006
      • 2

      #3
      Originally posted by sashi
      Hi there,

      Please state the problem statement clearly. What is your formula? Is there any runtime error?
      ic Class Form1

      Private Sub BtnOne_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles BtnOne.Click
      'determine BMI
      'Declare variables
      Dim weight As Double
      Dim height As Double
      height = CDbl(txtInches. Text)
      Call input(weight)
      Call DisplayBMI()

      End Sub
      Sub input(ByRef w As Integer)
      'get values from text boxes
      w = CDbl(txtWeight. Text)
      End Sub

      Function BMI(ByVal w As Double, ByVal h As Integer) As Double
      'determine BMI
      Dim weightb As Double
      Dim heightsqr As Integer
      weightb = w * 703
      heightsqr = h * h
      Return weightb / heightsqr
      End Function
      Sub DisplayBMI()
      'display bmi in list box
      Dim bodymass As Double
      Dim weight As Double
      weight = CDbl(txtWeight. Text)
      bodymass = BMI(weight, Height)
      With lstOutput.Items

      Comment

      Working...