Create the Control Panel interface that has the following 3 methods: public int warningLevel (); public...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create the Control Panel interface that has the following 3 methods: public int warningLevel (); public String status (); public boolean isok (); Write 2 public static methods 1) Write a public static method that will take a single Control Panel parameter. The method must return whether or not a single parameter of type ControlPanel meets any of these criteria. critical if the ControlPanel: status equals "bad" or "emergency" or warningLevel is more than 10 or warningLevel is 7 or more and not Ok or warningLevel is less than 1 The ControlPanel parameter may be null, if so, system is not critical 2) Write a public static method called maxWarning() that will accept a List of Control Panel. The method must return the Control Panel that contains the maximum warningLevel. Important, if the List parameter is null OR if it contains no items, null must be returned. Hint, ControlPanel is an interface but that will not stop you from being able to code the problem. 380816.1612744.qx3zqy7 Current file: TestControl.java 1 //OPTIONAL 2 //Finish this class if you want to for testing. It will need to implement Control Panel 3 public class TestControl{ 4 5 6 7} Load default template... Current file: Main.java ▾ Load default template... 1 import java.util.List; 2 3 public class Main 4 { 5 6 //TODO, write criticalWarning method here 7 //TODO, write the maxWarning method here 8 public static void main(String[] a) { 9 10 11 12 13 14 15 16 } 17 //DO NOT CHANGE any code below this point Main m = new Main(); m.testIt(); Current file: Main.java Load default template... if(!criticalWarning (new Test1())){ System.out.println("This should be critical since (warningLevel 7 or more and not Ok)"); } else System.out.println("Basic test 1 passed"); if(criticalWarning (new Test3())) { 17 18 private void testIt() { 19 20 21 22 23 24 25 26 27 28 29 30 } 31 32 class Test1 implements ControlPanel 33 System.out.println("This should NOT be critical (warningLevel 8, but isok is true)"); } else System.out.println("Basic test 2 passed"); 33 34 35 { Load default template... Current file: Main.java public int warningLevel(){ return 7; } public String status () { return "good"; } public boolean isok() { return false; class Test2 implements ControlPanel } 36 37 38 39 } 40 41 42 { 43 44 45 46 47 } 48 49 public int warningLevel(){ return 40; } public String status() { return "good"; } public boolean isok() { return true; } class Test3 implements ControlPanel 43 44 45 46 47 } 48 49 50 51 52 53 54 55 56 57 58 59} Load default template... Current file: Main.java public int warningLevel(){ return 40; } public String status() { return "good"; } public boolean isok() { return true; } class Test3 implements ControlPanel { public int warningLevel(){ return 8; } public String status () { return "gooder"; } public boolean isok() { return true; } File is marked as read only 1 //Make no changes here 2 public interface Control Panel 3 { 4 5 public int warningLevel(); 6 public String status(); 7 public boolean isok(); 8} Current file: ControlPanel.java ▾ Create the Control Panel interface that has the following 3 methods: public int warningLevel (); public String status (); public boolean isok (); Write 2 public static methods 1) Write a public static method that will take a single Control Panel parameter. The method must return whether or not a single parameter of type ControlPanel meets any of these criteria. critical if the ControlPanel: status equals "bad" or "emergency" or warningLevel is more than 10 or warningLevel is 7 or more and not Ok or warningLevel is less than 1 The ControlPanel parameter may be null, if so, system is not critical 2) Write a public static method called maxWarning() that will accept a List of Control Panel. The method must return the Control Panel that contains the maximum warningLevel. Important, if the List parameter is null OR if it contains no items, null must be returned. Hint, ControlPanel is an interface but that will not stop you from being able to code the problem. 380816.1612744.qx3zqy7 Current file: TestControl.java 1 //OPTIONAL 2 //Finish this class if you want to for testing. It will need to implement Control Panel 3 public class TestControl{ 4 5 6 7} Load default template... Current file: Main.java ▾ Load default template... 1 import java.util.List; 2 3 public class Main 4 { 5 6 //TODO, write criticalWarning method here 7 //TODO, write the maxWarning method here 8 public static void main(String[] a) { 9 10 11 12 13 14 15 16 } 17 //DO NOT CHANGE any code below this point Main m = new Main(); m.testIt(); Current file: Main.java Load default template... if(!criticalWarning (new Test1())){ System.out.println("This should be critical since (warningLevel 7 or more and not Ok)"); } else System.out.println("Basic test 1 passed"); if(criticalWarning (new Test3())) { 17 18 private void testIt() { 19 20 21 22 23 24 25 26 27 28 29 30 } 31 32 class Test1 implements ControlPanel 33 System.out.println("This should NOT be critical (warningLevel 8, but isok is true)"); } else System.out.println("Basic test 2 passed"); 33 34 35 { Load default template... Current file: Main.java public int warningLevel(){ return 7; } public String status () { return "good"; } public boolean isok() { return false; class Test2 implements ControlPanel } 36 37 38 39 } 40 41 42 { 43 44 45 46 47 } 48 49 public int warningLevel(){ return 40; } public String status() { return "good"; } public boolean isok() { return true; } class Test3 implements ControlPanel 43 44 45 46 47 } 48 49 50 51 52 53 54 55 56 57 58 59} Load default template... Current file: Main.java public int warningLevel(){ return 40; } public String status() { return "good"; } public boolean isok() { return true; } class Test3 implements ControlPanel { public int warningLevel(){ return 8; } public String status () { return "gooder"; } public boolean isok() { return true; } File is marked as read only 1 //Make no changes here 2 public interface Control Panel 3 { 4 5 public int warningLevel(); 6 public String status(); 7 public boolean isok(); 8} Current file: ControlPanel.java ▾
Expert Answer:
Answer rating: 100% (QA)
criticalWarning method checks if a given ControlPanel meets any of the specified criteria for critical warning maxWarning method finds the ControlPane... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Johnny buys the organic falafel used in his restaurant from Idoru Ltd. When Johnny complains to Idoru about a recent price increase, Idoru offers Johnny a special deal: Johnny will only have to pay...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Pettit Printing Company has a total market value of $100 million, consisting of 1 million shares selling for $50 per share and $50 million of 10 percent perpetual bonds now selling at par. The...
-
How large is the image of the Sun on film used in a camera with (a) A 28-mm-focal-length lens, (b) A 50-mmfocal-length lens, (c) A 135-mm-focal-length lens? (d) If the 50-mm lens is considered normal...
-
For the following exercises, write the equation of the parabola in standard form. Then give the vertex, focus, and directrix. (x + 2) 2 = 1/2 (y 1)
-
Consider the calculation of an external rate of return (ERR). The positive cash flows in the cash flow profile are moved forward to \(t=n\) using what value of \(i\) in the \((F \mid P i, n-t)\)...
-
Len Kumar started his own consulting firm. Kumar Consulting on June 1, 2017 the trial balance at June 30 is as follows. In addition to those accounts listed on the trial balance, the chart of...
-
Calculate the total billing amount for Jonas and his associate for their ( 1 ) first client assessment session and ( 2 ) second client assessment session. State whether they are the same or different...
-
A JFET is a ............ driven device Select one: a. voltage b. current c. both current and voltage d. none of the above
-
A 2 0 0 0 Hz sound wave passes through a wall with two narrow openings 3 0 cm apart. If sound travels on average 3 4 3 m / s , find the following. What is the angle of the first order maximum? ( b )...
-
4. Determine whether the following array declarations are valid. If a declara- tion is invaid, explain why. a. int list75; b. int size; double list [size]; C. int test[-10]; d. double sales [40.5];
-
James is planning to go to medical school and cover his tuition and living expenses by taking out student loans. The loan program has a stated 7 percent annual rate of interest, but interest is...
-
If you have $ 7 2 0 , 0 0 0 in an account earning 4 percent annually, what constant amount could you withdraw at the end of each month and have nothing remaining at the end of 2 0 years?
-
Initial rates of an enzyme catalyzed reaction for various substrate concentrations as shown below: [S] mM 0.52 0.103 0.049 0.0106 140 130 115 67 0.0051 43 (umoles/L/min) Determine the...
-
Draw a digraph (Directed Graph) that has the given vertex matrix: [0 1 0 0 100 1 0 100 [1011 Now use powers of vertex matrices to determine the number of steps of the 3-steps between the vertices P,...
-
1. Use these cost, revenue, and probability estimates along with the decision tree to identify the best decision strategy for Trendy's Pies. 2. Suppose that Trendy is concerned about her probability...
-
Create class SavingsAccount. Use a static variable annualInterestRateto store the annual interest rate for all account holders. Each object of the class contains a private instance variable...
-
Create a program that reads integer grades and stores them in an ArrayList, then use stream processing to display each grades letter equivalent (A, B, C, D or F). Response to comment: I assume it is...
-
Create a class called Clock that includes three instance variablesan hour (type int), a minute (type int) and a second (type int). Provide a constructor that initializes the three instance variables...
-
A single fair die is rolled. Let the event \(A\) be the face showing is even. Let the event \(B\) be the face showing is divisible by 3 . (a) List out the sample space of the experiment. (b) List the...
-
Two fair dice, one red and one green, are rolled. Let the event \(A\) be the sum of the faces showing is an even number. Let the event \(B\) be the sum of the faces showing is divisible by 3 . (a)...
-
Two fair dice, one red and one green, are rolled. Let the event \(A\) be the sum of the faces showing is equal to seven. Let the event \(B\) be the faces showing on the two dice are equal. (a) List...
Study smarter with the SolutionInn App