patterns/state/gumballmachine/app.d

41 lines
876 B
D

module app;
import gumballmachine;
import std.stdio : writeln;
void main()
{
GumballMachine gumballMachine = new GumballMachine(5);
writeln(gumballMachine);
gumballMachine.insertQuarter();
gumballMachine.turnCrank();
writeln(gumballMachine);
gumballMachine.insertQuarter();
gumballMachine.ejectQuarter();
gumballMachine.turnCrank();
writeln(gumballMachine);
gumballMachine.insertQuarter();
gumballMachine.turnCrank();
gumballMachine.insertQuarter();
gumballMachine.turnCrank();
gumballMachine.ejectQuarter();
writeln(gumballMachine);
gumballMachine.insertQuarter();
gumballMachine.insertQuarter();
gumballMachine.turnCrank();
gumballMachine.insertQuarter();
gumballMachine.turnCrank();
gumballMachine.insertQuarter();
gumballMachine.turnCrank();
writeln(gumballMachine);
}