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

I need the header files to use ONLY. #include \"stdafx.h\" #include <stdio.h> #i

ID: 3674915 • Letter: I

Question

I need the header files to use ONLY. #include "stdafx.h" #include <stdio.h> #include <math.h>

Open Visual Studio on your PC and select to create a New Project, name the new project BMI , and set the Location tosave to your flashdrive to your folder called MyProgramProjects .

Using the Scale program as a guide, write a new program that contains a function called CalculateBMI to compute the Body Mass Index for a person by completing the following steps:

Write code to ask the user to enter his heightInInches and his weightInPounds. Save these values as doubles.

Write code to call a function CalculateBMI and send it these 2 double values. Store the result that will be returned by this function to a double called BodyMassIndex.

Now write the function CalculateBMI that takes in these 2 double values. It should convert the person's height to meters (heightInMeters = heightInInches/39.37). Next it should convert the person's weight to kilograms (weightInKilograms = weightInPounds/2.2). Now it should calculate the person's BMI with the following formula: BMI = weightInKilograms / pow(heightInMeters,2). Finally, it should return this result back to the main program.

The main program should print a message to the screen "The Body Mass Index for this person is: " along with with the result.   

Don't forget to add a line at the very top: #include "stdafx.h" (needed for Visual Studio software). Save your program and Build it.

Explanation / Answer

Required Method:

double CalculateBMI(double heightInInches,double weightInPounds)

{

double BMI;

double heightInMeters= heightInInches/39.37;

double weightInKilograms=weightInPounds/2.2;

BMI=weightInKilograms/(heightInMeters*heightInMeters);

return BMI;

}

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