Hello. This assignment is in Visual Basic and VB Studio 4.5 Framework. Details a
ID: 3702752 • Letter: H
Question
Hello. This assignment is in Visual Basic and VB Studio 4.5 Framework. Details are below with a screenshot of an example runtime.
Task:
Create a simple BMI calculator to take in weight in lbs or kg and a height in m or in and produce a BMI number.
For Full Credit:
Program must be well documented and controls well named according to standards.
Your program MUST contain a separate class named Calculator.Your class must contain properties for height, weight, unit of height and unit of weight.
HINT: Use Double for your height and weight data type, not decimal
HINT: Use string for the the unit types
Your class MUST contain a public function that returns the BMI
Your class MUST contain one constructor to initialize the properties.
Weight and Height must be validated as numeric.
BMI MUST be displayed as xx.x format.
To convert Weight in LBS to KG use the formula: WEIGHT_KG = WEIGHT_LBS * .45
To convert Height in INCHES to M use the formula: HEIGHT_M = HEIGHT_IN * .025
To calculate BMI, use the formula: BMI = WEIGHT_KG / HEIGHT_M ^ 2
And heres a pic of the runtime
8MI Calculator Enter Vicight and Height Celculate Clear Ext Weight Height Cument BMExplanation / Answer
Hello,
Please find the program:
Public Class Calculator
Public Sub BMI()
Dim Height As Double
Dim Weight As Double
Dim BMI As Double
Dim Rounded_BMI As Double
Dim unit As String
Weight_KG = Weight_LBS * .45
Height_M = Height_IN * .025
BMI = Weight_KG / Height_M ^ 2
Rounded_BMI = Math.Round(BMI, 1)
lblBMI.Text = Rounded_BMI.ToString
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, e As System.EventArgs) Handles btnCalculate.Click
BMI()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, e As System.EventArgs) Handles btnExit.Click
Application .Exit ()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, e As System.EventArgs) Handles btnClear.Click
lblBMI.Text=””
txtheight.Clear()
txtweight.Clear()
End Sub
End Class
Thanks
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.