public static Coin ChooseCoinsForPayment() { Console.WriteLine("Enter coins for payment."); Console.WriteLine("Type 'penny', 'nickle', 'dime', 'quarter' to enter payment"); string input = Console.ReadLine(); Coin coin = null; switch (input) { case "penny": coin = new Penny(); break; case "nickle": coin = new Nickle(); break; case "Dime": coin = new Dime(); break; case "quarter": coin = new Quarter(); break; default: Console.WriteLine("Invalid entry"); ChooseCoinsForPayment(); break; } return(coin); }
public void StockNickleInMachine(int amount) { Nickle nickle = new Nickle(); for(int i = 0; i <= amount; i++) { register.Add(nickle); } }
public void AddNickleToWallet(int amount) { Nickle nickle = new Nickle(); for (int i = 0; i <= amount; i++) { coins.Add(nickle); } }