Code from Stage II to help with Stage III: Stage III – 30 points + 15 points testing The Nurses Union is very happy now

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Code from Stage II to help with Stage III: Stage III – 30 points + 15 points testing The Nurses Union is very happy now

Post by answerhappygod »

Code from Stage II to help with Stage III:
Stage III – 30 points + 15 points testing The Nurses Union is
very happy now that the deadband feature is up and working at KGH.
KGH is now looking to see if MedCo can step up their game. They
want to be able to have multiple limits on the temperature and
updates to the messages as well. After a few meetings (online, of
course) MedCo’s programmers and KGH agree to the following: There
will be a new class called Analog that will be the parent of Limit.
The clock timing logic must move from the Limit class to the Analog
class The Analog class will use the ArrayList feature to support
multiple Limits. The constructor for Analog will fill in the
default Limit Limit will need to add some new fields: id: This will
be a 4-character String. For backward compatibility, the default
Limit will have an ID of “STD “ This will default to “” (empty
string). The contents of printStr is added to the Alarm message
right after the word “Alarm” (see examples below). Analog will need
an addLimit() method that should pass in the ID, printStr, high,
low values as arguments. Example calls would be: addLimit(“HIGH”,
“High”, 39.0, 36.2); addLimit(“CRIT”, “Critical”, 40.0, 36.1);
limits must be added in order. For each new Limit, high must be
>= high for the previous limit added and low must be <= low
for the previously added limit. Code must throw Illegal Argument
Exception is this condition is not met. Analog will need a
deleteLimit() method that should pass in the ID to delete and
return true or false if the ID was found and deleted or not. Limit
will need a new version of CheckLimit that will not take the file
argument and it will return the current state of the Limit (enum of
NORMAL, LOW, HIGH). Analog will need a CheckAnalog method that is
passed the temperature and a file to printout any alarm or return
to normal. Any output must be appended to the end of the file.
CheckAnalog will need to test against all the current limits using
the new CheckLimit method. Any change in overall state should
result in one new line being added to the output file. If one Limit
returns to normal but the next Limit below it is still in
violation, then no Return message is formatted. For example:
3:02:10 PM Alarm: Temperature is 37.9C Over High Limit of 37.6C
3:47:10 PM Alarm High: Temperature is 39.2C Over High Limit of
39.0C 4:22:40 PM Alarm Critical: Temperature is 40.3C Over High
Limit of 40.0C 6:05:50 PM Alarm High: Temperature is 39.8C Over
High Limit of 39.0C 6:47:00 PM Alarm: Temperature is 38.9C Over
High Limit of 37.6C 11:17:00 PM Return: Temperature is 37.4C In
Range At 6:05, the critical alarm clears but the temperature is
still above the high Limit so that Limit is re-posted. At 6:47, the
high alarm clears but the temperature is still above the standard
Limit so that Limit is re-posted. Submission: Submit both your
source files (Analog.java, Limit.java, (and LimitState.java if it
is in its own file) ) with code for all of the Methods discussed
above and the Methods from Stages I & II. Also submit the Test
Code - preferably in a separate .java file Additional Details: Here
is a sequence that shows how an Analog Object should look after a
sequence of calls using the Analog methods. 1) Use the constructor
to create an Analog Object called "temperature". It should have one
Limit in the Array List of Limit objects when done: Analog
temperature Limit[0] STD 36.5 37.6 .... 2) Make a call to the add
limit method. It should now have two Limit records in the Array
List of Limit objects when done: temperature.addLimit( HIGH, 36.0,
38.5 ); Analog Temperature Limit[0] STD 36.5 37.6 .... Limit[1]
HIGH 36.0 38.5 .... 3) Make another call to the add limit method.
It should now have three Limit records in the Array List of Limit
objects when done: temperature.addLimit( CRIT, 35.0, 39.5 );;
Analog Temperature Limit[0] STD 36.5 37.6 .... Limit[1] HIGH 36.0
38.5 .... Limit[2] CRIT 35.0 39.5 .... 4) Make a call to the add
limit method but with bad argument(s). It should still have three
Limit records in the Array List of Limit objects when done:
temperature.addLimit( BAD, 35.3, 41.0 ); // Should throw Illegal
Argument Exception because 35.3 > 35.0 5) Make a call to the add
limit method. It should now have four Limit records in the Array
List of Limit objects when done: Analog Temperature Limit[0] STD
36.5 37.6 .... Limit[1] HIGH 36.0 38.5 .... Limit[2] CRIT 35.0 39.5
.... Limit[3] DEAD 33.0 42.5 .... 6) Make a call to the remove
limit method. It should now be back to three Limit records in the
Array List of Limit objects when done: temperature.removeLimit (
CRIT ); Analog Temperature Limit[0] STD 36.5 37.6 .... Limit[1]
HIGH 36.0 38.5 .... Limit[2] DEAD 33.0 42.5 ....
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply