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 130. 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: 1 ; Caffeine: 200
ID: 2; Caffeine: 400
ID: 3; Caffeine: 600
ID: 4; Caffeine: 800
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:
 Write a program will manage a collection of patients' caffeine levels:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!