Question
Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would
Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes. Here is the pseudo code:
// Global constant for body mass
Constant Real BODY_MASS_MULTIPLIER = 703
// main module
Module main()
// Local variables
Declare Real Weight, Height, BMI, OverUnder
// Get the weight
Call getWeight(Weight)
// Get the height
Call getHeight(Height)
// Calculate the body mass
Call setMass(Weight, Height, BMI)
// Calculate the over/under indicator
Call setOverUnder(BMI, OverUnder)
// Display body mass and indicator
Call showBMI(BMI, OverUnder)
End Module
// The getWeight module gets weight and stores it
// in the inputWeight reference variable.
Module getWeight (Real Ref inputWeight)
Display Enter the weight.
Input inputWeight
End Module
// The getHeight module gets height and stores it
// in the inputHeight reference variable.
Module getHeight(Real Ref inputHeight)
Display Enter the height.
Input inputHeight
End Module
// The setMass module sets the BMI and stores it
// in the BMI reference variable.
Module setMass(Real Weight, Height, Ref BMI)
Set BMI = Weight * (BODY_MASS_MULTIPLIER/(Height* Height))
End Module
// The setOverUnder module sets the BMI and stores it
// in the BMI reference variable.
Module setOverUnder(Real BMI, Ref OverUnder)
If BMI > 25 Then
Set OverUnder = 3
Else
If BMI < 18.5 Then
Set OverUnder = 1
Else
Set OverUnder = 2
End If
End Module
// The showBMI module accepts BMI as argument and displays the
// body mass indicator
Module showBMI(Real BMI, OverUnder)
Display "Body Mass Indicator: ", BMI
Select OverUnder
Case 1:
Display You are Overweight
Case 2:
Display Your Weight is Optimal
Case 3:
Display You are Underweight
End Select
End Module
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started