Question: Write a program will manage a collection of patients' caffeine levels: Patient: Contains three instance variables for ID number and caffeine level ( measured in
Write a program will manage a collection of patients' caffeine levels:
Patient:
Contains three instance variables for ID number and caffeine level measured in milligrams,
use a double here
Implements a parameterized constructor that will create a Patient object with a given ID and
specified amount of caffeine in their system.
PatientManager:
Contains a single instance variable representing an array of ten patients.
Implements a default constructor.
Implements a method that will add a Patient object to the first available spot in the patient.
array. This method should take a Patient object as a parameter, and return an int, representing
the index of the array the object was placed.
Implement a method that will remove and return a Patient object at a given index in the
patient array. An int should be passed into this method.
Implement a method called caffeineAbsorption that will take no parameters, and reduce the
caffeine level of every patient in the patient array by If the patient has no caffeine
remaining after, they should be removed from the array!
Implement a ToString method that will print the ID and Caffeine value for each patient in the
PatientManager object in the patient array If there are no patients, print "Empty"
PatientTester:
Implement a main function that will carry out the following instructions:
Instantiate a PatientManager object
Print the PatientManager object you created
Add four patient objects to the PatientManager object you created with the following
parameters:
ID: ; Caffeine:
ID: ; Caffeine:
ID: ; Caffeine:
ID: ; Caffeine:
Print the PatientManager object you created
Call the caffeineAbsorption method twice within PatientManager
Print the PatientManager object you created
Remove the patient object from PatientManager with the highest amount of caffeine
currently
Print the PatientManager object you created
Expected Output:
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
