You need to modify the code so the result which prints to the label states the category the user is in. The table of categories is below. BMI range - kg/m? Category Severe Thinness < 16 Moderate Thinness 16 - 17 Mild Thinness 17 - 18.5 Normal 18.5 - 25 25 - 30 30 - 35 35 - 40 > 40 Overweight Obese Class I Obese Class II Obese Class III You can use else if statements to do this probably the easiest method or Select Case to do it. For example Dim yBMI As Decimal Select Case yBMI Case yBMI < 16 Code Here Case And so on et
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
the progam is :
Public Class Form1
Public Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
'Declare variables
Dim vHeight As Decimal
Dim vWeight As Decimal
Dim vBMI As Decimal
'get and test values entered by user
'tests user has entered a value for height
If txbHeight.Text = “” Or txbWeight.Text = “” Then
'Call error message sub procedure
ErrorMessage(“Please enter your height and weight in the box!”)
Exit Sub
End If
'Calculate Body Mass initialize variables
vWeight = Val(txbWeight.Text)
vHeight = Val(txbHeight.Text)
'Calculate Body Mass Index ^ is for exponents
vBMI = vWeight / (vHeight ^ 2)
'Output message to Label
txbResult.Text = vBMI
Call ErrorMessage()
End Sub
Public Sub ErrorMessage() 'public sub for error msg box
End Sub
Public Sub ErrorMessage(errormsg As String) ' parameter for error message
MessageBox.Show(errormsg) 'to show the message box
End Sub
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click 'close button
Close() ' close
End Sub
End Class
.................................................................................................................
please add this to the progam ( the image)
(note that this is visual basic windows form app)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images