Question: Create the Control Panel interface that has the following 3 methods: public int warningLevel (); public String status (); public boolean isok (); Write








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
Step by Step Solution
3.37 Rating (156 Votes )
There are 3 Steps involved in it
criticalWarning method checks if a given ControlPanel meets any of the specified criteria for critical warning maxWarning method finds the ControlPane... View full answer
Get step-by-step solutions from verified subject matter experts
