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 noquarterstate;
|
|
|
|
|
|
|
|
import std.stdio : writeln;
|
|
|
|
import state, gumballmachine;
|
|
|
|
|
|
|
|
class NoQuarterState : 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
|
|
|
gumballMachine.setState(gumballMachine.getHasQuarterState());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ejectQuarter()
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
writeln("Вы не вставили четвертак");
|
2022-11-19 23:40:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void turnCrank()
|
|
|
|
{
|
2022-11-20 18:09:50 +00:00
|
|
|
writeln("Вы дернули за рычаг, но нет четвертака");
|
2022-11-19 23:40:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|