Oven
JavaScript is disabled on your browser.
Skip navigation links
Package
Class
Tree
Deprecated
Index
Help
All Classes
SEARCH:
JavaScript is disabled on your browser.
Summary:
Nested |
Field |
Constr |
Method
Detail:
Field |
Constr |
Method
Class Oven
java.lang.Object
Oven
public class Oven
extends java.lang.Object
This class models an oven appliance for cooking food.
Constructor Summary
Constructors Constructor Description
Oven()
Creates an Oven object with a default maximum temperature of 320 degrees Celsius
Oven(int maxTemperature)
Creates an Oven object with a specific maximum temperature
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
int getCurrentTemperature()
Gets the current temperature (the oven has no heating or cooling times and changes temperatures instantly)
int getMaxTemperature()
Gets the maximum temperature this oven can be set to
void insertFood(Food food,
int duration)
Adds an item of food to the oven, potentially changing its state.
void setTemperature(int temperature)
Sets the current temperature of the oven to the given value
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
Oven
public Oven()
Creates an Oven object with a default maximum temperature of 320 degrees Celsius
Oven
public Oven(int maxTemperature)
Creates an Oven object with a specific maximum temperature
Parameters:
maxTemperature – The maximum temperature this oven can be set to. Cannot be a negative number.
Throws:
java.lang.IllegalArgumentException – If the maxTemperature is negative
Method Detail
setTemperature
public void setTemperature(int temperature)
Sets the current temperature of the oven to the given value
Parameters:
temperature – The temperature to set in degrees Celsius
Throws:
java.lang.IllegalArgumentException – If the temperature is negative or higher than this oven’s maximum temperature.
getCurrentTemperature
public int getCurrentTemperature()
Gets the current temperature (the oven has no heating or cooling times and changes temperatures instantly)
Returns:
The current temperature in degrees Fahrenheit
getMaxTemperature
public int getMaxTemperature()
Gets the maximum temperature this oven can be set to
Returns:
The max temperature in degrees Celsius
insertFood
public void insertFood(Food food,
int duration)
Adds an item of food to the oven, potentially changing its state.
Parameters:
food – The food to be added to the oven
duration – The length of time in minutes the food will be in the oven for
Throws:
java.lang.IllegalArgumentException – If the food parameter is null, or if the duration is negative
Skip navigation links
Package
Class
Tree
Deprecated
Index
Help
All Classes
JavaScript is disabled on your browser.
Summary:
Nested |
Field |
Constr |
Method
Detail:
Field |
Constr |
Method