Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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 created

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

What is the objective of a statement of changes in equity?

Answered: 1 week ago