Question
Write the code in C++ PROBLEM Your grandmother has just come back from the doctors office and is confused about all the numbers that were
Write the code in C++
PROBLEM Your grandmother has just come back from the doctors office and is confused about all the numbers that were used to evaluate her health. The nurse weighed her, took her blood pressure, noted her cholesterol from her lab work, told her to sit down, and said that the doctor would be in shortly. After half an hour the doctor came in, looked at her chart, smiled, and said that she was fine. In looking over the report they gave your grandmother, you realize that there could be a market for a program to explain this information to medical patients. You have a project due in your software engineering class, so you decide to write a program to do exactly that.
Before you can state the input and output from this program, you need to do some research on the Web. You find that there are two important parts to a cholesterol reading: HDL (good) and LDL (bad). The ratio of the two is also important. You find several references that provide interpretations for a range of input values. The interpretation of your weight is dependent on the ratio of our weight to your size as represented by the body mass index (BMI). Great, you already have a program to calculate the BMI! Blood pressure is made up of two values: systolic and diastolic. When talking about blood pressure, the readings are usually given as something over something, such as 120/80. The first value is the systolic pressure, and the second value is the diastolic pressure. Now you have enough information to determine the input for your program.
INPUT Patients name, HDL, LDL, weight in pounds, height in inches, systolic pressure, and diastolic pressure.
OUTPUT Patients name and an interpretation of the cholesterol, weight, and blood pressure readings are written on file Profile.
DISCUSSION The decomposition of this problem into tasks is very straightforward. The data values are prompted for, entered, and evaluated. The only question is whether to enter the data all at once and evaluate it or have each evaluation module enter its own data. The principle of information hiding suggests that we embed the data gathering within the functions that evaluate the data.
Here are the interpretations you found on the Internet concerning cholesterol.
HDL Interpretation
<40 Too low
>=40and <60 Is okay
>=60 Excellent
LDL Interpretation
<100 Optimal
>=100 and <130 Near optimal
>=130 and <160 Borderline high
>=160 and <190 High
>=190 Very high
Fortunately, you already have a BMI calculator that can simply be turned into a function (with the food suggestions removed). What about blood pressure readings? Again, here is what you found on the Internet concerning blood pressure readings.
Systolic Interpretation
< 120 Optimal
< 130 Normal
< 140 Normal high
< 160 Stage 1 hypertension
< 180 Stage 2 hypertension
>= 180 Stage 3 hypertension
Diastolic Interpretation
< 80 Optimal
< 85 Normal
< 90 High normal
< 100 Stage 1 hypertension
<110 Stage 2 hypertension
>= 110 Stage 3 hypertension
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started