Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Heater
- {
- private int temperature;
- /**
- * Creates a new Heater with an initial temperature of 15.
- */
- public Heater()
- {
- temperature = 15;
- }
- /**
- * Increases the temperature by 5 degrees
- */
- public void warmer()
- {
- temperature += 5;
- }
- /**
- * Decreases the temperature by 5 degrees
- */
- public void cooler()
- {
- temperature -= 5;
- }
- /**
- * Gets the current temperature of the heater
- */
- public int getTemperature()
- {
- return temperature;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment