patterns/facade/hometheater/tuner.d

50 lines
874 B
D

module tuner;
import amplifier;
import std.stdio : writeln;
import std.conv : to;
class Tuner
{
private string description;
private Amplifier amplifier;
private double frequency;
this(string description, Amplifier amplifier)
{
this.description = description;
this.amplifier = amplifier;
}
void on()
{
writeln(description ~ " on");
}
void off()
{
writeln(description ~ " off");
}
void setFrequency(double frequency)
{
writeln(description ~ " setting frequency to " ~ frequency.to!string);
this.frequency = frequency;
}
void setAm()
{
writeln(description ~ " setting AM mode");
}
void setFm()
{
writeln(description ~ " setting FM mode");
}
override string toString() const
{
return description;
}
}