public void FillRegister()
        {
            Quarter quarter = new Quarter();
            Dime    dime    = new Dime();
            Nickle  nickle  = new Nickle();
            Penny   penny   = new Penny();

            for (int i = 0; i < 20; i++)
            {
                quarter = new Quarter();
                register.Add(quarter);
            }
            for (int i = 0; i < 10; i++)
            {
                dime = new Dime();
                register.Add(dime);
            }
            for (int i = 0; i < 20; i++)
            {
                nickle = new Nickle();
                register.Add(nickle);
            }
            for (int i = 0; i < 50; i++)
            {
                penny = new Penny();
                register.Add(penny);
            }
        }
 public SodaMachine()
 {
     register          = new List <Coin>();
     inventory         = new List <Can>();
     temporaryRegister = new List <Coin>();
     for (int i = 0; i < 20; i++)
     {
         Quarter quarter = new Quarter();
         register.Add(quarter);
     }
     for (int i = 0; i < 10; i++)
     {
         Dime dime = new Dime();
         register.Add(dime);
     }
     for (int i = 0; i < 20; i++)
     {
         Nickle nickle = new Nickle();
         register.Add(nickle);
     }
     for (int i = 0; i < 50; i++)
     {
         Penny penny = new Penny();
         register.Add(penny);
     }
     for (int i = 0; i < 10; i++)
     {
         RootBeer   rootBeer   = new RootBeer();
         Cola       cola       = new Cola();
         OrangeSoda orangeSoda = new OrangeSoda();
         inventory.Add(cola);
         inventory.Add(rootBeer);
         inventory.Add(orangeSoda);
     }
 }
Example #3
0
        public List <Coin> ChooseCoins(Coin coin, string coinName)
        {
            List <Coin> coins = new List <Coin>();

            while (coinName != "stop")
            {
                if (coinName == "quarter")
                {
                    coin = new Quarter();
                    coins.Add(coin);
                }
                else if (coinName == "nickel")
                {
                    coin = new Nickle();
                    coins.Add(coin);
                }
                else if (coinName == "dime")
                {
                    coin = new Dime();
                    coins.Add(coin);
                }
                else if (coinName == "penny")
                {
                    coin = new Penny();
                    coins.Add(coin);
                }
            }
            return(coins);
        }
Example #4
0
        //member methods
        public void AddCoinstoWallet()
        {
            //create a for loop to add the coins
            for (int i = 0; i < 10; i++)
            {
                Penny penny = new Penny();
                coins.Add(penny);
            }

            for (int i = 0; i < 12; i++)
            {
                Quarter quarter = new Quarter();
                coins.Add(quarter);
            }

            for (int i = 0; i < 10; i++)
            {
                Dime dime = new Dime();
                coins.Add(dime);
            }

            for (int i = 0; i < 20; i++)
            {
                Nickle nickle = new Nickle();
                coins.Add(nickle);
            }
        }
Example #5
0
        public Wallet()
        {
            coins = new List <Coin>();
            for (int index = 0; index < 16; index++)
            {
                Quarter quarter = new Quarter();
                coins.Add(quarter);
            }
            for (int index = 0; index < 10; index++)
            {
                Dime dime = new Dime();
                coins.Add(dime);
            }
            for (int index = 0; index < 10; index++)
            {
                Nickle nickle = new Nickle();
                coins.Add(nickle);
            }
            for (int index = 0; index < 50; index++)
            {
                Penny penny = new Penny();
                coins.Add(penny);
            }

            card = new Card();
        }
Example #6
0
        public void AddCoinsToRegisterForPurchase(Can can)
        {
            double remainingChangeAmountToAdd = can.Cost;

            while () // while there is still change to be added to the register
            {
                // determine what coin to add to the register (using division?)
                // create (instantiate) the coin object to add to the register
                // add the created coin object to the register
                // lower the value of 'remainingChangeAmountToAdd by the value of the coin that was just added

                //Quarter quarter = new Quarter();
                //Dime dime = new Dime();


                if (remainingChangeAmountToAdd > .25) // we can add a quarter
                {
                    Quarter quarter = new Quarter();
                    register.Add(quarter);
                    remainingChangeAmountToAdd -= quarter.Value;
                }
                else if (remainingChangeAmountToAdd > .10) // we should add a dime next
                {
                    Dime dime = new Dime();
                    register.Add(dime);
                    remainingChangeAmountToAdd -= dime.Value;
                }
                else if (remainingChangeAmountToAdd > .05)
                {
                    Nickle nickle = new Nickle();
                    register.Add(nickle);
                    remainingChangeAmountToAdd -= nickle.Value;
                }
                else
                {
                    Penny penny = new Penny();
                    register.Add(penny);
                    remainingChangeAmountToAdd -= penny.Value;
                }
            }
        }
        public List <Coin> CreateChange(double changeValue)
        {
            double      change        = changeValue;
            List <Coin> createdChange = new List <Coin>();

            new List <Coin>();
            while (change > 0)
            {
                if (change >= 0.25)
                {
                    change = change - 0.25 + 0.000001;
                    Quarter quarter = new Quarter();
                    createdChange.Add(quarter);
                }
                else if (change >= 0.10)
                {
                    change -= 0.10 + 0.000001;
                    Dime dime = new Dime();
                    createdChange.Add(dime);
                }
                else if (change >= 0.05)
                {
                    change -= 0.05 + 0.000001;
                    Nickle nickle = new Nickle();
                    createdChange.Add(nickle);
                }
                else if (change >= 0.009997999999999993)
                {
                    change -= .01;
                    Penny penny = new Penny();
                    createdChange.Add(penny);
                }
                else
                {
                    break;
                }
            }
            return(createdChange);
        }
Example #8
0
 //member methods
 public void FillWallet()
 {
     for (int i = 0; i < 12; i++)
     {
         quarter = new Quarter();
         coins.Add(quarter);
     }
     for (int i = 0; i < 10; i++)
     {
         dime = new Dime();
         coins.Add(dime);
     }
     for (int i = 0; i < 10; i++)
     {
         nickle = new Nickle();
         coins.Add(nickle);
     }
     for (int i = 0; i < 10; i++)
     {
         penny = new Penny();
         coins.Add(penny);
     }
 }
Example #9
0
 //Methods(Can Do)
 public void MoneyInWallet()
 {
     for (int i = 0; i < 4; i++)
     {
         Quarter quarter = new Quarter();
         coins.Add(quarter);
     }
     for (int i = 0; i < 10; i++)
     {
         Dime dime = new Dime();
         coins.Add(dime);
     }
     for (int i = 0; i < 20; i++)
     {
         Nickle nickle = new Nickle();
         coins.Add(nickle);
     }
     for (int i = 0; i < 100; i++)
     {
         Penny penny = new Penny();
         coins.Add(penny);
     }
 }
Example #10
0
 private void StartingChange()
 {
     for (int i = 0; i < 12; i++)
     {
         Quarter quarter = new Quarter();
         customerCoins.Add(quarter);
     }
     for (int i = 0; i < 10; i++)
     {
         Dime dime = new Dime();
         customerCoins.Add(dime);
     }
     for (int i = 0; i < 10; i++)
     {
         Nickle nickle = new Nickle();
         customerCoins.Add(nickle);
     }
     for (int i = 0; i < 50; i++)
     {
         Penny penny = new Penny();
         customerCoins.Add(penny);
     }
 }
Example #11
0
 //Methods(Can Do)
 public void InsertChangeInRegister()
 {
     for (int i = 0; i < 20; i++)
     {
         Quarter quarter = new Quarter();
         register.Add(quarter);
     }
     for (int i = 0; i < 10; i++)
     {
         Dime dime = new Dime();
         register.Add(dime);
     }
     for (int i = 0; i < 20; i++)
     {
         Nickle nickle = new Nickle();
         register.Add(nickle);
     }
     for (int i = 0; i < 50; i++)
     {
         Penny penny = new Penny();
         register.Add(penny);
     }
 }
Example #12
0
        public static string PickCoins()
        {
            Console.WriteLine("Select which coins you would like to use to pay: \n" + "--- ( 1 ) = Penny --- \n" + "--- ( 2 ) = Nickle --- \n"
                              + "--- ( 3 ) = Dime --- \n" + "--- ( 4 ) = Quarter --- \n");
            ConsoleKeyInfo thing = Console.ReadKey();
            Coin           coin;

            if (thing.Key == ConsoleKey.D1)
            {
                coin = new Penny("Penny");
                Console.WriteLine(" You have deposited .01 cents!");
                return("Penny");
            }
            else if (thing.Key == ConsoleKey.D2)
            {
                coin = new Nickle("Nickle");
                Console.WriteLine(" You have deposited .05 cents!");
                return("Nickle");
            }
            else if (thing.Key == ConsoleKey.D3)
            {
                coin = new Dime("Dime");
                Console.WriteLine(" You have deposited .10 cents!");
                return("Dime");
            }
            else if (thing.Key == ConsoleKey.D4)
            {
                coin = new Quarter("Quarter");
                Console.WriteLine(" You have deposited .25 cents!");
                return("Quarter");
            }
            else
            {
                Console.Clear();
                return("nothing");
            }
        }
Example #13
0
 public Wallet()
 {
     coins = new List <Coin>();
     for (int i = 0; i < 12; i++)
     {
         Quarter quarter = new Quarter();
         coins.Add(quarter);
     }
     for (int i = 0; i < 10; i++)
     {
         Dime dime = new Dime();
         coins.Add(dime);
     }
     for (int i = 0; i < 10; i++)
     {
         Nickle nickle = new Nickle();
         coins.Add(nickle);
     }
     for (int i = 0; i < 50; i++)
     {
         Penny penny = new Penny();
         coins.Add(penny);
     }
 }
Example #14
0
        public static Nickle Nickle()
        {
            Nickle nickle = new Nickle();

            return(nickle);
        }