예제 #1
0
        // constructor (SPAWN)
        public SodaMachine()
        {
            hopperIn  = new List <Coin>();
            hopperOut = new List <Coin>();
            register  = new List <Coin>();
            Quarter quarter = new Quarter();
            Dime    dime    = new Dime();
            Nickel  nickel  = new Nickel();
            Penny   penny   = new Penny();

            AddToInventory(quarter, 20);
            AddToInventory(dime, 10);
            AddToInventory(nickel, 20);
            AddToInventory(penny, 50);

            inventory = new List <Can>();
            Cola       cola       = new Cola();
            OrangeSoda orangeSoda = new OrangeSoda();
            RootBeer   rootBeer   = new RootBeer();

            AddToInventory(cola, 5);
            AddToInventory(orangeSoda, 5);
            AddToInventory(rootBeer, 5);

            cardPaymentBalance = 0;
        }
예제 #2
0
파일: Wallet.cs 프로젝트: royalisme7/soda
        public void MixChange()
        {
            for (int i = 0; i < 8; i++)
            {
                Coin quarter = new Quarter();
                MyChange.Add(quarter);
            }
            for (int i = 0; i < 10; i++)
            {
                Coin dime = new Dime();
                MyChange.Add(dime);
            }

            for (int i = 0; i < 20; i++)
            {
                Coin nickel = new Nickel();
                MyChange.Add(nickel);
            }

            for (int i = 0; i < 100; i++)
            {
                Coin penny = new Penny();
                MyChange.Add(penny);
            }
        }
예제 #3
0
        public List <Nickel> stockNickels()
        {
            for (int nickelStock = 0; nickelStock < 20; nickelStock++)
            {
                Nickel nickel = new Nickel();
                nickels.Add(nickel);
            }

            return(nickels);
        }
예제 #4
0
        // constructor
        public Wallet()
        {
            coins = new List <Coin>();
            Quarter quarter = new Quarter();
            Dime    dime    = new Dime();
            Nickel  nickel  = new Nickel();
            Penny   penny   = new Penny();

            AddMoney(quarter, 12); // $3 in quarters
            AddMoney(dime, 10);    // $1 in dimes
            AddMoney(nickel, 15);  // $.75 in nickels;
            AddMoney(penny, 25);   // $.25 in pennies
            card = new Card();
        }