Write a function that will prompt for the current persons


Assignment

When writing C++ programs include comments in your code, make the program readable by indenting, use meaningful variable and function names, and produce meaningful output.

This assignment will be to write a bmi calculation program that interacts with the end user - using the guidelines and sample output below.

Program: 20 points - bmi.cpp

Write a program that will do the following:

? Write a main function that will use a FOR LOOP - define a constant integer TOTAL_PEOPLE equal to 4. Use this constant to control how many times your FOR LOOP loops. Within the FOR LOOP you will be calling each of the following functions you will write.

? Write a function that will prompt for the current person's weight in pounds and return that weight..

? Write a function that will prompt for the current person's height in FEET and INCHES and return total height in INCHES.

? Write a function that will calculate and return the current person's BMI

? BMI Formula = (pounds*703) / (inches * inches)

? If your pounds and inches are defined as integers instead of doubles, you will need to multiply them by 1.0 in the above formula to make them be treated as real numbers for the division (otherwise it will do integer division)

? Write a function that will calculate and return the BMI classification string based on the calculated BMI.

? (-infinity, 18.5)   "Underweight"
? [18.5, 25)          "Normal weight"
? [25, 30)             "Overweight"
? [30, +infinity)     "Obesity"

? Write a function that will print the results of the BMI function and the BMI classification. In this function when you print the BMI value use the cout formatting options fixed and setprecision(2) to properly display only 2 decimal places for the BMI value.

? Use the examples below to run your program with - you should get the same results.

Remember to write this in baby steps compiling a little bit at a time - do not try to write all the functions at once and run it, it is much easier to troubleshoot by adding only a few lines of code and compile to see how that works. For example on this program - write main first with no other functions - get main working with a for loop, that loops 4 times

-- use testing/debugging cout statements to prove that your loop is looping 4 times. Next create the function get_weight, call this function inside your for loop, you should see that it prompts you 4 times to enter the weight - put testing/debugging cout statement in main to prove that you correct prompted and returned back to main the weight. Do this same step of adding one function at a time and testing/debugging as you go --- add a few (1-9) lines not 10's/100's of lines before you compile and check what you just added, if you have a problem it is most likely in those last few lines of code you just added/changed.

Example program run:

Enter weight in pounds for person #1 : 138 Enter height (feet and inches) for person #1 : 6 2

Person #1 weighs 138 pounds and is 74 inches tall with a calculated BMI of 17.72 and a classification of: Underweight

Enter weight in pounds for person #2 : 175 Enter height (feet and inches) for person #2 : 5 9

Person #2 weighs 175 pounds and is 69 inches tall with a calculated BMI of 25.84 and a classification of: Overweight

Enter weight in pounds for person #3 : 245 Enter height (feet and inches) for person #3 : 6 0
Person #3 weighs 245 pounds and is 72 inches tall with a calculated BMI of 33.22 and a classification of: Obesity

Enter weight in pounds for person #4 : 142 Enter height (feet and inches) for person #4 : 5 4

Person #4 weighs 142 pounds and is 64 inches tall with a calculated BMI of 24.37 and a classification of: Normal weight

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a function that will prompt for the current persons
Reference No:- TGS01722941

Now Priced at $45 (50% Discount)

Recommended (99%)

Rated (4.3/5)