package week12day3;

public class Microwave {
	private int temperature = 0;
	private static final int TOO_HOT = 40;
	
	public void cook(int time, Food food) throws Exception{
		food.cook(time);
		if(food.burned()){
			temperature += 5;
		}
		if(temperature >= TOO_HOT){
			throw new Exception("Microwave overheated! It is now unsafe to operate!");
		}
		System.out.println("Your food is " + (food.cooked()?"":"not ") + "cooked.");
	}
	
	public void cook(int time, Metal thing) throws Exception{
		throw new Exception("Don't you know it's a bad idea to put metal in the microwave? It's overheated and unsafe to use now!");
	}
}
