Question: Question 4 : Define a class named Patient that contains: ? ( ) a . A String variable named name. b . A double variable
Question :
Define a class named Patient that contains:
a A String variable named name.
b A double variable named weight.
c A double variable named height.
d A default constructor to initialize the three variables.
e A parameterized constructor to initialize the three instance variables.
f One accessor method for each one of the three instance variables.
g One mutator method for each one of the three instance variables.
h A method named BMI with no parameters to return the body mass index of the patient using the following formula: MMI weight height
i A patientStatus method to display the patient status as follows and has one argument double bmi:
tableBMIWeight StatusBMI Underweight BMI Normal BMI OverweightBMI Obese
Write a main class named PatientTest that:
a Instantiate class Patient with object name p
b Call the appropriate mutator methods to set the values of name, weight, and height of p to Adam, and respectively.
c Display the body mass index for the Patient p
d Display the patient status of Patient p
e Create another object of Patient named p with Huda, and for name, weight, and height respectively. Use parameterized constructor
f Call the BMI and patient status methods for the Patient p
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
