Question: Write a C++ program to be used by a personal trainer at a health club to calculate a person's ideal weight based on the person's
Write a C++ program to be used by a personal trainer at a health club to calculate a person's ideal weight based on the person's gender and height
Define a structure called Client to store a person's name, gender (M or F), and height (in inches). Chose appropriate data types for structure members. 2. In the main function define a Client pointer variable and dynamically (using the new operator) assign the pointer an address of dynamically allocated Client. The pointer variable should be used for all processing of the Client Data. 3. Pass the pointer to a function that prompts the user to enter a name, gender, and height (in inches) for a client, using the pointer, store the data in the structure via pointer parameter. Compile, debug, and run your program to make sure the function is working before going on to the next step. Use getline(cin, variableName); to read in the client's name as it may contain spaces. 4. Pass the pointer to another function to display the client's name, gender, height, ideal weight, and weight range. Use the formulas below to calculate the ideal weight (based on the Hamwi formula for a medium frame) and the recommended weight range. Male: Ideal body weight = 106 pounds for first 5 feet + 6 pounds for each inch over 5 feet. Female: Ideal body weight = 100 pounds for first 5 feet + 5 pounds for each inch over 5 feet. Recommended weight range (both male and female): ideal body weight plus or minus 15 pounds Calculate expected results by hand and record them in the spaces below for the sample data: Jack Black, a male who is 70 inches tall (5' 10"): Name Jack Black Height: 70 <---- note double quotes should be displayed to indicate inches!
Ideal weight: _________#
Weight range: _________# to _________# Try other heights for males and females to test your program to make sure it is working correctly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
