Answered step by step
Verified Expert Solution
Question
1 Approved Answer
OOP help! I use Java in Eclipse and am trying to create a program that does the following. I need three .java files, one for
OOP help! I use Java in Eclipse and am trying to create a program that does the following. I need three .java files, one for each class, as defined below.
Write a program will manage a collection of patients' caffeine levels: . o 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. o . o O Patient Manager: Contains a single instance variable representing an array of six patients. o 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. o 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. o Implement a method called caffeine Absorption() 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 number of patients in the Patient Manager object (in the patient array) o . Patient Tester: Implement a main() function that will carry out the following instructions: Instantiate a Patient Manager object Print the Patient Manager object you created Add four patient objects to the Patient Manager object you created with the following parameters: ID: 1; Caffeine: 100 ID: 2; Caffeine: 200 ID: 3; Caffeine: 300 ID: 4; Caffeine: 400 Print the Patient Manager object you create Call the caffeine Absorption method within PatientManager Print the Patient Manager object you created Remove the patient object from Patient Manager with the highest amount of caffeine currently Print the Patient Manager object you createdStep 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