Question: MicrowaveTester.java public class MicrowaveTester { public static void main(String[] args) { Microwave appliance = new Microwave(); appliance.increaseTime(); appliance.increaseTime(); appliance.increaseTime(); appliance.switchPower(); appliance.start(); System.out.println(Expected:Cooking for 90 seconds

A simple class for modelling a microwave oven. Difficulty: Easy See the

MicrowaveTester.java

public class MicrowaveTester
{
public static void main(String[] args)
{

Microwave appliance = new Microwave();

appliance.increaseTime();
appliance.increaseTime();
appliance.increaseTime();
appliance.switchPower();

appliance.start();
System.out.println("Expected:Cooking for 90 seconds at power HIGH");

appliance.reset();

appliance.increaseTime();
appliance.switchPower();
appliance.switchPower();
appliance.start();
System.out.println("Expected:Cooking for 30 seconds at power LOW");

}
}

Microwave.java (has todo)


/** A class for representing a microwave oven.
*/
public class Microwave {


int timer;
String power; //HIGH or LOW

/** Creates a microwave with 0 seconds on the timer and at LOW power.
*/
public Microwave()
{
//-----------Start below here. To do: approximate lines of code = 2
// Complete this constructor to initialize instance variables


//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
}

/** Increases the time on the timer by 30 seconds.
*/
public void increaseTime()
{
//-----------Start below here. To do: approximate lines of code = 1
// complete the method

//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
}

/** Switches the power level from LOW to HIGH, or vice versa.
*/
public void switchPower()
{
//-----------Start below here. To do: approximate lines of code = 4
// Complete this method.




//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
}

/** Resets the microwave to its initial state.
*/
public void reset()
{
//-----------Start below here. To do: approximate lines of code = 2
// Complete this method.


//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
}

public void start()
{
System.out.println("Cooking for " + timer + " seconds at power " + power);  
}

}


P.s: please have output screenshots so we know the program operates smoothly

A simple class for modelling a microwave oven. Difficulty: Easy See the following files: * MicrowaveTester.java * Microwave.java (has todo) Approximate total lines of code required: 9

Step by Step Solution

3.44 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

MicrowaveTesterjava public class MicrowaveTester public static void mainString args Microwave applia... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!