stage of t s assignment, I have the code up… stage of t s assignment, I have the code up to stage two. Here’s the code I have so far and the instructions: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 classThe Analog class will use the ArrayList feature to support multiple Limits. The constructor for Analog will fill in the default LimitLimit will to add some new fields:id: T s will be a 4-character String. For backward compatibility, the default Limit will have an ID of “STD “T s 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 an addLimit() method that should pass in the ID, printStr, gh, low values as arguments. Example calls would be:addLimit(” GH”, ” gh”, 39.0, 36.2);addLimit(“CRIT”, “Critical”, 40.0, 36.1);limits must be added in order. For each new Limit, gh must be >= gh for the previous limit added and low must be <= low for the previously added limit. Code must throw Illegal Argument Exception is t s condition is not met.Analog will 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 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, GH).Analog will 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 to test against all the current limits using the ne WhicheckLimit 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 gh Limit of 37.6C3:47:10 PM Alarm gh: Temperature is 39.2C Over gh Limit of 39.0C4:22:40 PM Alarm Critical: Temperature is 40.3C Over gh Limit of 40.0C6:05:50 PM Alarm gh: Temperature is 39.8C Over gh Limit of 39.0C6:47:00 PM Alarm: Temperature is 38.9C Over gh Limit of 37.6C11:17:00 PM Return: Temperature is 37.4C In Range At 6:05, the critical alarm clears but the temperature is still above the gh Limit so that Limit is re-posted.At 6:47, the gh alarm clears but the temperature is still above the standard Limit so that Limit is re-posted.My code:package limit;import java.io.FileOutputStream;import java.text.DecimalFormat;/** * * @author Jake Fyfe *//** * * enumerated variables to hold the values of the normal, gh and low temperatures */enum LimitState { NORMAL, LOW, GH }public class Limit { /** * variables to be hold the permanent values of the gh and low limits as well as the strings to show the gh, low and normal conditions. * As well as a variable for the new deadband set to 0.1. */ double gh; double low; double deadband = 0.1; String ghStr; String lowStr; String normStr; /** * No argument constructor method for the limit */public Limit() { gh = 37.6; low = 36.5; } /** * Method for limit with parameters for gh and low * @param gh * @param low */public Limit(double gh,double low) { super(); t s. gh = gh; t s.low = low; } /** * Methods that return gh and low with no changes; * @return */public double get gh() { return gh; }public double getLow() { return low; } /** * get methods for the strings holding the gh, low and normal conditions. */public String get ghStr() { return ghStr; }public String getLowStr() { return lowStr; }public String getNormStr() { return normStr; } /** * Get method to return the default value of deadband. * @return */public double getDeadBand() { return deadband; } /** * method to set the value of the string ghStr to the parameter passed * @param ghStr */public void set ghStr(String ghStr) { t s. ghStr = ghStr; } /** * method to set the value of the string lowStr to the parameter passed * @param lowStr */public void setLowStr(String lowStr) { t s.lowStr = lowStr; } /** * method to set the value of the string normStr to the parameter passed * @param normStr */public void setNormStr(String normStr) { t s.normStr = normStr; } /** * Setter method for the strings that show the gh, low, and normal conditions * @param gh * @param low * @param normal */public void setStrings(String gh, String low, String normal) { t s. ghStr = gh; t s.lowStr = low; t s.normStr = normal; } /** * setter method for gh that changes the value to that of the parameter * @param gh */public void set gh(double gh) { t s. gh= gh; } /** * setter method for low that changes the value to that of the parameter * @param low */public void setLow(double low) { t s.low=low; } /** * setter method for the value of deadband set to the parameter being passed. * @param deadband */public void setDeadband(double deadband) { t s.deadband = deadband; } /** * Print method that prints the settings of the temperature range */public void print() { System.out.println("Settings"); System.out.println("The gh Temperature is " + gh); System.out.println("The Low Temperature is " + low); } LimitState currentState = LimitState.NORMAL; /** * T s method checks the temperature of the patient and returns the appropriate message if the temperature is too gh, too low, or normal * @param temperature * @param file * @param time */public void checkLimit(double temperature, String file, String time) { String message = ""; boolean newStateNormal = false; if (currentState.equals(LimitState. GH) && temperature <= ( gh - deadband) || (currentState.equals(LimitState.LOW) && temperature >= (low + deadband))) { newStateNormal = true; } if (temperature > gh && newStateNormal) { currentState = LimitState. GH; message = time + ” Alarm: Temperature is ” + temperature + “C ” + ghStr + ” Limit of ” + gh + “C”; } else if (temperature < low && newStateNormal) { currentState = LimitState.LOW; message = time + " Alarm: Temperature is " + temperature + "C " + lowStr + " Limit of " + low + "C"; } else { if (currentState.equals(LimitState.NORMAL)) { currentState = LimitState.NORMAL; message = time + " Return: Temperature is " + temperature + "C " + normStr + " "; } } try { if (message.isEmpty()) { FileOutputStream outputStream = new FileOutputStream(file, true); byte[] strToBytes = ("rn" + message).getBytes(); outputStream.write(strToBytes); outputStream.close(); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { Limit test = new Limit(); test.setStrings("Over gh", "Under Low", "In Range"); DecimalFormat formatter = new DecimalFormat("00"); /** * t s for loop is simulating the clock incrementing up by 10 seconds and is randomly calculating the temp to be checked */ for (int hours = 1; hours <= 3; hours++) { for (int minutes = 0; minutes <= 59; minutes++) { for (int seconds = 0; seconds <= 59; seconds+=10) { String time = formatter.format(hours) + ":" + formatter.format(minutes) + ":" + formatter.format(seconds) + "PM"; Limit l = new Limit(); double temp = 35 + (Math.random() * (38 - 35)+1); l.checkLimit(temp, "tempFile.txt",time); } } } } }Computer ScienceEngineering & TechnologyJava ProgrammingCS& 141Share Question
by | May 18, 2023 | Uncategorized
stage of t s assignment, I have the code up… stage of t s assignment, I have
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Order Now and we will direct you to our Order Page at Litessays. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
Advantages of working with us
- Huge discounts to new customers
- Error free essays and homework
- Plagiarism free essays
- On time and high quality delivery
- Wide sources of study materials
Order Now