Guest User

Untitled

a guest
Sep 22nd, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public class Heater
  2. {
  3.     private int temperature;
  4.  
  5.     /**
  6.      *  Creates a new Heater with an initial temperature of 15.
  7.      */
  8.     public Heater()
  9.     {
  10.         temperature = 15;
  11.     }
  12.    
  13.     /**
  14.      * Increases the temperature by 5 degrees
  15.      */
  16.     public void warmer()
  17.     {
  18.         temperature += 5;
  19.     }
  20.  
  21.     /**
  22.      * Decreases the temperature by 5 degrees
  23.      */
  24.     public void cooler()
  25.     {
  26.         temperature -= 5;
  27.     }
  28.  
  29.     /**
  30.      * Gets the current temperature of the heater
  31.      */
  32.     public int getTemperature()
  33.     {
  34.         return temperature;
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment