Question
Project B: Patient Class Write a definition of a class that has the following properties. a. The name of the class is Patient. b. The
Project B: Patient Class
Write a definition of a class that has the following properties.
a. The name of the class is Patient. b. The class Patient has the following member variables:
name (string), height (double), age and weight (int). c. The class Patient has the following member functions:
setName setAge setWeight setHeight getName getAge getWeight getHeight display weightStatus
sets the name sets the age sets the weight sets the height returns the name returns the age
returns the weight returns the height outputs the data in the member variables in a nice format returns a string according to the following chart (taken from: http://www.whathealth.com/bmi/formula.html )
BMI | Weight Status |
Below 18.5 | Underweight |
18.5 -24.9 | Normal |
25 - 29.9 | Overweight |
30 & Above | Obese |
The formula for BMI (body mass index) is given below: BMI = (weight in pounds * 703) / (height in inches)2
d. Write definitions of all the member functions of class Patient. Once you have written the class, write a separate program that creates three Patient
objects named patJane, patTim, and patLinda, to hold the following data:
The program should store data in these objects (call the setter functions to assign these values: do not prompt the user to enter anything) and then display the data for each patient to the screen (name, age, height, weight, and weight status) in label format as shown below:
Name: Jane North Age: 25 Height: 66 inches Weight: 120 pounds Weight Status: Normal
Next Page
Name | Age | Height | Weight |
Jane North | 25 | 66 | 120 |
Tim South | 64 | 72 | 251 |
Linda East | 52 | 69 | 175 |
Note: For one of the objects use the getter functions. For the other two objects call the display() member function. Do not use an array of objects (you will use one in 5C).
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