コード例 #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 プロジェクト: colingalvin/SodaMachine
        // constructor (SPAWN)
        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();
        }