001package headfirst.command.party; 002 003public class Hottub { 004 boolean on; 005 int temperature; 006 007 public Hottub() { 008 } 009 010 public void on() { 011 on = true; 012 } 013 014 public void off() { 015 on = false; 016 } 017 018 public void circulate() { 019 if (on) { 020 System.out.println("Hottub is bubbling!"); 021 } 022 } 023 024 public void jetsOn() { 025 if (on) { 026 System.out.println("Hottub jets are on"); 027 } 028 } 029 030 public void jetsOff() { 031 if (on) { 032 System.out.println("Hottub jets are off"); 033 } 034 } 035 036 public void setTemperature(int temperature) { 037 if (temperature > this.temperature) { 038 System.out.println("Hottub is heating to a steaming " + temperature + " degrees"); 039 } 040 else { 041 System.out.println("Hottub is cooling to " + temperature + " degrees"); 042 } 043 this.temperature = temperature; 044 } 045}