예제 #1
0
        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);
        }
예제 #2
0
 public void StockNickleInMachine(int amount)
 {
     Nickle nickle = new Nickle();
     for(int i = 0; i <= amount; i++)
     {
         register.Add(nickle);
     }
 }
예제 #3
0
        public void AddNickleToWallet(int amount)
        {
            Nickle nickle = new Nickle();

            for (int i = 0; i <= amount; i++)
            {
                coins.Add(nickle);
            }
        }