Question: Need to make a microwave oven program using classes like beeper button cancelbutton cookbutton door light microwave mytimer(picture attached) oven powertube UPDATE: I am writing
Need to make a microwave oven program using classes like beeper button cancelbutton cookbutton door light microwave mytimer(picture attached) oven powertube

UPDATE:
I am writing out the "MyTimer" here:
package microwave;
import java.util.Timer;
import java.util.TimerTask;
public class MyTimer {
private int time; //as seconds
private boolean isrunning;
Timer t;
Oven oven;
public MyTimer(Oven oven){
isrunning = false;
time = 0;
this.oven = oven;
}
public void Add1Minute(){
if(isrunning) return;
t= new Timer();
time = 60;
isrunning = true;
System.out.println("Added 1 minute of cook time");
StartTimer();
public void AddExtraMinute(){
time = time + 60;
System.out.println("Added 1 minute of cook time");
}
private void StartTimer(){
t.scheduleAtFixedRate(new TimerTask(){
public void run(){
System.out.println(time);
time--;
if(time == 0){
Alert();
t.cancel();
}
}
}, 0, 1000); //TimerTask, startAtOnce, Milliseconds
}
private void Alert(){
oven.TimerExpired();
isrunning = false;
}
boolean isRunning(){
return isrunning;
}
public void Cancel(){
t.cancel();
time=0;
isrunning = false;
}
}
Task: Implement your CRC classes in Java. Of course this program is just a simulator - it doesn't actually cook. But do the following: 1 As text output when the door is opened display a message "Door is open" 2. When the door is closed display a message "Door is closed" 3. When the cook button is pressed display a. Light is on b. Added 1 minute of cook time C. Power tube is on... d. Beep! 4. Start a countdown from 60 seconds and display the time 5. If the door is open and the cook button pressed just beep and do nothing else 6. Use d' to toggle the door open and closed 7. Use p'to press the cook button 8. When cooking is done (timer reached zero) display a. Light is off b. Beep c. Beep! d. Beep! 9. If p'is pressed while the oven is running, add 60 seconds to cook time. The number of seconds remaining should be equal to 60 plus whatever amount of time was at the point of pressing 'p 10. If 'c' is pressed while the oven is running, turn off the light, the power tube, zero the timer and beep. If not running just beep. Display a. Light is off b. Beep c. Cooking cancelled by pressing Cancel 11. If 'd' is pressed while oven is running, turn off the light, the power tube, zero the timer and beep. If not running justb eep. Display oor a. Cooking cancelled by opening d b. Light is on Since the oven has no display the messages printed in the simulator are for our reference only. The oven would not actually display anything but we could certainly see the light and hear the beeper the power tube You might want to use my myTimer class. myTimer has a separate thread of execution so the timer can run and return to the oven so the oven can continue to accept and process input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
