public virtual void Purchase(Customer c) { if (status != MachineStatus.Shutdown) { // customer make selection chosen = new Good("Вафли"); display.Show("Вы выбрали " + chosen.Name); expected = prices[chosen]; while (!CheckTotal()) { if (cancel) break; display.Show("Внесите " + WaitFor() + " руб"); c.CheckoutWallet(); Coin coin = c.Find(); if (c.isAvaliable(coin)) { c.Spend(coin); Insert(c, coin); } if (totalBill > expected) c.Get(new Coin(totalBill-expected)); } c.CheckoutWallet(); display.Show("Вот " + chosen.Name); totalBill = 0; } }