This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
2022-11-19 23:40:58 +00:00
|
|
|
module hasquarterstate;
|
|
|
|
|
|
|
|
import std.stdio : writeln;
|
|
|
|
import state, gumballmachine;
|
|
|
|
|
|
|
|
class HasQuarterState : State
|
|
|
|
{
|
|
|
|
GumballMachine gumballMachine;
|
|
|
|
|
|
|
|
this(GumballMachine gumballMachine)
|
|
|
|
{
|
|
|
|
this.gumballMachine = gumballMachine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void insertQuarter()
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
writeln("Вы не можете вставить еще один четвертак");
|
2022-11-19 23:40:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ejectQuarter()
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
writeln("Четвертак возвращен");
|
2022-11-19 23:40:58 +00:00
|
|
|
gumballMachine.setState(gumballMachine.getNoQuarterState());
|
|
|
|
}
|
|
|
|
|
|
|
|
void turnCrank()
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
writeln("Вы дернули за рычаг...");
|
2022-11-19 23:40:58 +00:00
|
|
|
gumballMachine.setState(gumballMachine.getSoldState());
|
|
|
|
}
|
|
|
|
|
|
|
|
void dispense()
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
writeln("Жевательная резинка не выдается");
|
2022-11-19 23:40:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void refill() {}
|
|
|
|
|
|
|
|
override string toString() const
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
return "ожидание поворота рычага";
|
2022-11-19 23:40:58 +00:00
|
|
|
}
|
|
|
|
}
|