示例#1
0
        //Member Methods (Can Do)

        //A method to fill the sodamachines register with coin objects.
        public void FillRegister()
        {
            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++)
            {
                Nickel nickel = new Nickel();
                _register.Add(nickel);
            }
            for (int i = 0; i < 50; i++)
            {
                Penny penny = new Penny();
                _register.Add(penny);
            }
        }
 //Member Methods (Can Do)
 //Fills wallet with starting money
 private void FillRegister()
 {
     for (int i = 0; i <= 10; 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++)
     {
         Nickel nickel = new Nickel();
         Coins.Add(nickel);
     }
     for (int i = 0; i <= 50; i++)
     {
         Penny penny = new Penny();
         Coins.Add(penny);
     }
 }