题目描述

A health care issue that has been in the news lately is the computerization of health records. This possibility is being approached cautiously because of sensitive privacy and security concerns, among others. [We address such concerns in later exercises.] Computerizing health records could make it easier for patients to share their health profiles and histories among their various health care professionals. This could improve the quality of health care, help avoid drug conflicts and erroneous drug prescriptions, reduce costs and in emergencies, could
save lives.
In this exercise, you’ll design a “starter” HealthProfile class for a person.
The class attributes should include the person’s first name, last name, gender, date of birth (consisting of separate attributes for the month, day and year of birth), height (in inches) and weight (in pounds).
Your class should have a constructor that receives this data. For each attribute, provide set and get functions.
The class also should include functions that calculate and return the user’s age in years, maximum
heart rate and target-heart-rate range (see Exercise 3.16), and body mass index (BMI; see
Exercise 2.30).
Write an application that prompts for the person’s information, instantiates an object of class HealthProfile for that person and prints the information from that object—including the person’s first name, last name, gender, date of birth, height and weight—then calculates and prints the person’s age in years, BMI, maximum heart rate and target-heart-rate range. It should also display the “BMI values” chart from Exercise 2.30. Use the same technique as Exercise 3.16 to calculate the person’s age.


输入格式

The first line contains the person's first name and last name.
The second line contains the gender.
The third line contains the person's month, day and year of birth.
The fourth line contains the height and weight.
The last line contains the current month, day and year.


输出格式

The main function have been given, please implement the HealthProfile class.


样例数据

输入

Joe James
M
1 21 1978
66 100
7 1 2022

输出

First Name: Joe
Last Name: James
Gender: M
Date of Birth: 1/21/1978
Height (inches): 66
Weight (pounds): 100
Age: 44
Maximum Heart Rate: 176
Target Heart Rate: 88-149
Body Mass Index: 16

BMI VALUES                        
Underweight: less than 18.5       
Normal:      between 18.5 and 24.9
Overweight:  between 25 and 29.9  
Obese:       30 or greater

备注

BMI = weightInPounds × 703 / (heightInInches × heightInInches)


操作

评测记录

优秀代码

信息

时间限制: 1s
内存限制: 128MB
评测模式: Normal

题解