Question: Write a C++ program which prompts the user to enter numbers for given limits and value steps for possible person weights and heights. The program

Write a C++ program which prompts the user to enter numbers for given limits and value steps for possible person weights and heights. The program then calculates the body mass index (BMI) and creates a matrix based on these inputs. Implement only one of the two formulas but make sure that your menu mentions the measurement units.

Write a C++ program which prompts the user to (weight in kg, height in m) or (weight in lbs, height in inches)

A sample run of your program (for weight in kg and height in meters) should look like:

This program can calculate the BMI of a person for given limits and value steps and creates a matrix based on these inputs.

Please enter minimum weight in kg: 70

Please enter maximum weight in kg: 110

Please enter weight step in kg: 5

Please enter minimum height in meters: 1.5

Please enter maximum height in meters: 2

Please enter height step in meters: 0.1

The BMI for the given inputs is the following:

Height 1.50 1.60 1.70 1.80 1.90

Weight

70.00 31.11 27.34 24.22 21.60 19.39

75.00 33.33 29.30 25.90 23.15 20.78

80.00 35.56 31.25 27.68 24.69 22.16

85.00 37.78 33.20 29.41 26.23 23.55

90.00 40.00 35.16 31.14 27.78 24.93

95.00 42.22 37.11 32.87 29.32 26.32

100.00 44.44 39.06 34.60 30.86 27.70

105.00 46.67 41.02 36.33 32.41 29.09

110.00 48.89 42.97 38.06 33.95 30.47

Do you want to repeat (Y/N)?

(The numbers 70, 110, 5, 1.5, 2 and 0.1 are entered by the user.)

A sample run of your program (for weight in lbs and height in inches) should look like:

This program can calculate the BMI of a person for given limits and value steps and creates a matrix based on these inputs.

Please enter minimum weight in lbs: 154

Please enter maximum weight in lbs: 242

Please enter weight step in lbs: 11

Please enter minimum height in inches: 59

Please enter maximum height in inches: 78.7

Please enter height step in inches: 3.9

The BMI for the given inputs is the following:

Height 59.00 62.90 66.80 70.70 74.60 78.50

Weight

154.00 31.10 27.36 24.26 21.66 19.45 17.57

165.00 33.32 29.32 25.99 23.21 20.84 18.82

176.00 35.54 31.27 27.73 24.75 22.23 20.08

187.00 37.77 33.23 29.46 26.30 23.62 21.33

198.00 39.99 35.18 31.19 27.85 25.01 22.59

209.00 42.21 37.14 32.93 29.39 26.40 23.84

220.00 44.43 39.09 34.66 30.94 27.79 25.10

231.00 46.65 41.05 36.39 32.49 29.18 26.35

242.00 48.87 43.00 38.13 34.04 30.57 27.61

Do you want to repeat (Y/N)?

(The numbers 154, 242, 11, 59, 78.7 and 3.9 are entered by the user.)

The program will prompt the user to enter minimum and maximum values for weight and height as well as value steps for weight and height. The program is required to work if the numbers entered by the user are decimals. All calculations done in the program should be using decimal values. NOTE: You won't have to care for invalid weight and height inputs for this homework. The program will be tested only for cases that values entered are nonnegative and within appropriate ranges.

The prompts displayed by the program must be formatted as shown in the sample runs (e.g. blank lines, spacing, case of text). The results should be printed as a matrix that is readable and uniformly formatted. You can format the spacing in your matrix using spaces, tabs, or the setw() function.

The first row of the matrix will show the possible height values (from minimum to maximum increased by the entered step), while the first column on the left will show the possible weight values (from minimum to maximum increased by the entered step). The rest of the matrix cells will show the values of the calculated BMI for the corresponding weight columns and height rows. The results should be displayed with two decimal points. You will need to use nested loops to print the results in a matrix.

The program should continue running as long at the user answers 'Y' or 'y' to the question: Do you want to repeat (Y/N)?

If the user enters 'N' or 'n', the program should quit with a message. For example:

Do you want to repeat (Y/N)? N

Program Quitting...

If the user answers something else, the program should continue asking for a valid input in order to continue. For example:

Do you want to repeat (Y/N)? K

Invalid Input! Please answer Y or N

The numerical data that is outputted is supposed to appear like numbers in a matrix or table or graph or something so the appearance of such does matter to me. Thank you for the assistance.

BMI = |weight height

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!