Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete labs 2-5 using Visual Logic in which you: Submit the .vls file you crea

ID: 3690343 • Letter: C

Question

Complete labs 2-5 using Visual Logic in which you:

Submit the .vls file you create in Visual Logic as well as a screenshot of the output. For full credit, the program must function correctly, produce the correct answer, and be logically succinct.

a.Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI). BMI is a statistical measure that compares a person’s weight and height. The program uses three modules. The first prompts a user for and accepts the user’s height in inches. The second module accepts the user’s weight in pounds and converts the user’s height to meters and weight to kilograms. Then, it calculates BMI as weight in kilograms divided by height in meters squared, and displays the results. There are 2.54 centimeters in an inch, 100 centimeters in a meter, 453.59 grams in a pound, and 1,000 grams in a kilogram. Use named constants whenever you think they are appropriate. The last module displays the message End of job. b. Revise the BMI-determining program to execute continuously until the user enters 0 for the height in inches.

Explanation / Answer

a.

#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
void main ()
{
const double H_M=0.0254; //height in meters
const double W_K=0.453592;   // weight in kilograms
double h;               //height in inches
double w;               //weight in pounds
double bmi=0;

//inputs
cout<<"Enter height in inches:";
cin>>h;
cout<<"Enter weight in pounds:";
cin>>w;

//calculations
//h = pow(h*H_M,2);
bmi=(W_K*w)/(h*h);

//outputs
cout<<"BMI is:"<<bmi;
cout<<"Are you Healthy?";
cout<<"END OF THE JOB";
}

b.

#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
void main ()
{
const double H_M=0.0254; //height in meters
const double W_K=0.453592;   // weight in kilograms
double h;               //height in inches
double w;               //weight in pounds
double bmi=0;

//input for height
cout<<"Enter height in inches:";
cin>>h;

//calculations
while(h!=0)
{
   cout<<"Enter height in pounds";
   cin>>w;
   h = pow((h*H_M),2);
   bmi=(W_K*w)/h;
   //outputs
   cout<<"BMI is:"<<bmi;
   cout<<"Enter height in inches";
   cin>>h;
}
cout<<"END OF THE JOB";
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote