001package headfirst.facade.hometheater;
002
003public class Amplifier {
004        String description;
005        Tuner tuner;
006        DvdPlayer dvd;
007        CdPlayer cd;
008
009        public Amplifier(String description) {
010                this.description = description;
011        }
012
013        public void on() {
014                System.out.println(description + " on");
015        }
016
017        public void off() {
018                System.out.println(description + " off");
019        }
020
021        public void setStereoSound() {
022                System.out.println(description + " stereo mode on");
023        }
024
025        public void setSurroundSound() {
026                System.out.println(description + " surround sound on (5 speakers, 1 subwoofer)");
027        }
028
029        public void setVolume(int level) {
030                System.out.println(description + " setting volume to " + level);
031        }
032
033        public void setTuner(Tuner tuner) {
034                System.out.println(description + " setting tuner to " + dvd);
035                this.tuner = tuner;
036        }
037
038        public void setDvd(DvdPlayer dvd) {
039                System.out.println(description + " setting DVD player to " + dvd);
040                this.dvd = dvd;
041        }
042
043        public void setCd(CdPlayer cd) {
044                System.out.println(description + " setting CD player to " + cd);
045                this.cd = cd;
046        }
047
048        public String toString() {
049                return description;
050        }
051}