public GumMachine(int balls, IOutputWritter writter) { _balls = balls; _writter = writter; SoldOut = new SoldOutState(this,_writter); NoPenny = new NoPennyState(this, _writter); Sold = new SoldState(this, _writter); HasPenny = new HasPennyState(_writter, this); CurrentState = _balls<=0 ? SoldOut : NoPenny; }