I’m having trouble getting my code to compile. Could you help me please?
I’m having trouble getting my code to compile. Could you help me please?
public class microwave {
boolean isOn = true;
public microwave(){
}
public boolean isOn() {
return isOn;
}
public void display() {
System.out.println(“The microwave is ready:” + microwave.this.isOn);
}
public static void main(String[] args) {
microwave spin = new microwave();
spin.display();
}
}
…………………………………………………………………………………………….
import java.util.Scanner;
public class MicrowaveOven {
public static void main(String[] args) {
//Create class
Scanner in = new Scanner(System.in);
microwave microstate = new microwave();
//Ask user if they want the microwave on/off
System.out.println(“Would you like to turn the microwave on? (True or False)”);
System.out.println(“\nThe state of microwave is: \n”
+ “On: ” + (microstateget.MicroState() + “\nState: ” + microstateget.MicroState() + “\n”);
Boolean microTurnOn = in.nextBoolean();
if (microTurnOn) {
System.out.println(“The microwave has been turned on.”);
System.out.println(“Please select a food to heat. (1=pizza, 2=popcorn, 3=fish)”);
int microstateFood = in.nextInt();
if (microstateFood == 1) {
microstateset.MicroState(1);
System.out.println(“Pizza has been selected to heat.”);
} else if (microstateFood == 2) {
microstateset.MicroState(2);
System.out.println(“Popcorn has been selected to heat.”);
} else if (microstateFood == 3) {
microstateset.MicroState(3);
System.out.println(“Fish has been selected to heat.”);
} else {
System.out.println(“You have made an invalid selection.”);
}
}
}
}