示例#1
0
        public Can PrepareCan(string canChoice)
        {
            Can actualCan = null;

            switch (canChoice)
            {
            case "cola":
                Can cola = new Cola();
                if (ContainsCan(cola))
                {
                    actualCan = cola;
                }
                break;

            case "orange soda":
                Can orange = new OrangeSoda();
                if (ContainsCan(orange))
                {
                    actualCan = orange;
                }
                break;

            case "root beer":
                Can rootbeer = new RootBeer();
                if (ContainsCan(rootbeer))
                {
                    actualCan = rootbeer;
                }
                break;

            default:
                break;
            }
            return(actualCan);
        }
示例#2
0
 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);
     }
 }
        public SodaMachineA()
        {
            register = new List <Coin>();
            cans     = new List <Can>();

            Quarter quarter = new Quarter();

            SetStartingMoney(20, quarter);

            Nickel nickel = new Nickel();

            SetStartingMoney(20, nickel);

            Penny penny = new Penny();

            SetStartingMoney(50, penny);

            Dime dime = new Dime();

            SetStartingMoney(10, dime);

            Cola cola = new Cola();

            SetStartingCans(10, cola);

            OrangeSoda orange = new OrangeSoda();

            SetStartingCans(10, orange);

            RootBeer rootbeer = new RootBeer();

            SetStartingCans(10, rootbeer);
        }
示例#4
0
 void FillBackBack()
 {
     can        = new List <Can>();
     orangeSoda = new OrangeSoda();
     rootBeer   = new RootBeer();
     cola       = new Cola();
 }
示例#5
0
        //cans
        public void AddRootBeerToSelectedCans()
        {
            RootBeer rootbeer = new RootBeer();

            selectedCans.Add(rootbeer);
            totalBill += rootbeer.Cost;
        }
示例#6
0
        public static string PickASoda()
        {
            Console.WriteLine("Select a can of soda you would like to buy by entering the number assosiated with it: \n" + "--- ( 1 ) = Cola --- \n" + "--- ( 2 ) = OrangeSoda --- \n" + "--- ( 3 ) = RootBeer --- \n");
            ConsoleKeyInfo thing = Console.ReadKey();
            Can            can;

            if (thing.Key == ConsoleKey.D1)
            {
                can = new Cola("Cola");
                Console.WriteLine(" You picked a nice refreshing Cola!");
                return("Cola");
            }
            else if (thing.Key == ConsoleKey.D2)
            {
                can = new OrangeSoda("OrangeSoda");
                Console.WriteLine(" You picked cool can of OrangeSoda!");
                return("OrangeSoda");
            }
            else if (thing.Key == ConsoleKey.D3)
            {
                can = new RootBeer("RootBeer");
                Console.WriteLine(" You picked a nice cold RootBeer!");
                return("RootBeer");
            }
            else
            {
                Console.WriteLine("Please select again..");
                return("nothing");
            }
        }
 private void StockRootBeer()
 {
     for (int i = 0; i < 12; i++)
     {
         RootBeer rootBeer = new RootBeer();
         inventory.Add(rootBeer);
     }
 }
示例#8
0
 private void FillRootBeer(int startingRootBeer)
 {
     for (int i = 0; i < startingRootBeer; i++)
     {
         RootBeer rootBeer = new RootBeer();
         _inventory.Add(rootBeer);
     }
 }
示例#9
0
 public void AddRootBeer(int count)
 {
     for (int i = 0; i < count; i++)
     {
         Can can = new RootBeer();
         inventory.Add(can);
     }
 }
示例#10
0
        //A method to fill the sodamachines inventory with soda can objects.
        public void FillInventory()
        {
            Cola       cola       = new Cola();
            RootBeer   rootBeer   = new RootBeer();
            OrangeSoda orangeSoda = new OrangeSoda();

            AdministratorDepositCansIntoInventory(cola, 10);
            AdministratorDepositCansIntoInventory(rootBeer, 10);
            AdministratorDepositCansIntoInventory(orangeSoda, 1);
        }
示例#11
0
        //Soda machine starts with 20 of each kind of soda

        public void StartingCans()
        {
            for (int i = 0; i < 20; i++)
            {
                Cola       cola       = new Cola();
                OrangeSoda orangeSoda = new OrangeSoda();
                RootBeer   rootBeer   = new RootBeer();
                inventory.Add(cola);
                inventory.Add(orangeSoda);
                inventory.Add(rootBeer);
            }
        }
示例#12
0
 private void StartingCans()
 {
     for (int i = 0; i < 5; i++)
     {
         Cola cola = new Cola();
         cans.Add(cola);
     }
     for (int i = 0; i < 0; i++)
     {
         OrangeSoda orangeSoda = new OrangeSoda();
         cans.Add(orangeSoda);
     }
     for (int i = 0; i < 2; i++)
     {
         RootBeer rootBeer = new RootBeer();
         cans.Add(rootBeer);
     }
 }
示例#13
0
 public void StartingInventory(int rootBeers, int colas, int orangeSodas)
 {
     for (int i = 0; i < rootBeers; i++)
     {
         RootBeer rootBeer = new RootBeer();
         inventory.Add(rootBeer);
     }
     for (int i = 0; i < colas; i++)
     {
         Cola cola = new Cola();
         inventory.Add(cola);
     }
     for (int i = 0; i < orangeSodas; i++)
     {
         OrangeSoda orangeSoda = new OrangeSoda();
         inventory.Add(orangeSoda);
     }
 }
示例#14
0
 //A method to fill the sodamachines inventory with soda can objects.
 public void FillInventory()
 {
     for (int i = 0; i < 10; i++)
     {
         RootBeer rootBeer = new RootBeer();
         _inventory.Add(rootBeer);
     }
     for (int i = 0; i < 6; i++)
     {
         Cola cola = new Cola();
         _inventory.Add(cola);
     }
     for (int i = 0; i < 10; i++)
     {
         OrangeSoda orangeSoda = new OrangeSoda();
         _inventory.Add(orangeSoda);
     }
 }
示例#15
0
        //member methods
        private void fillSodaMachine()
        {
            quarter    = new Quarter();
            dime       = new Dime();
            nickel     = new Nickel();
            penny      = new Penny();
            orangeSoda = new OrangeSoda();
            rootBeer   = new RootBeer();
            cola       = new Cola();
            Functions.CreateCans(cola, 5, inventory);
            Functions.CreateCans(orangeSoda, 9, inventory);
            Functions.CreateCans(rootBeer, 1, inventory);

            Functions.CreateCoins(quarter, 20, register); //20
            Functions.CreateCoins(dime, 10, register);    //10
            Functions.CreateCoins(nickel, 20, register);  //20
            Functions.CreateCoins(penny, 50, register);   //50
        }
示例#16
0
 public void InitializeInventory()
 {
     for (int i = 0; i < 10; i++)
     {
         orangeSoda = new OrangeSoda();
         inventory.Add(orangeSoda);
     }
     for (int i = 0; i < 10; i++)
     {
         rootBeer = new RootBeer();
         inventory.Add(rootBeer);
     }
     for (int i = 0; i < 10; i++)
     {
         cola = new Cola();
         inventory.Add(cola);
     }
 }
示例#17
0
 public int InsertSodasInMachine()
 {
     for (int i = 0; i < 10; i++)
     {
         RootBeer rootBeer = new RootBeer();
         inventory.Add(rootBeer);
     }
     for (int i = 0; i < 10; i++)
     {
         Orange_Soda orange_Soda = new Orange_Soda();
         inventory.Add(orange_Soda);
     }
     for (int i = 0; i < 10; i++)
     {
         Cola cola = new Cola();
         inventory.Add(cola);
     }
     return(inventory.Count());
 }
示例#18
0
        //A method to fill the sodamachines inventory with soda can objects.
        public void FillInventory()
        {      // self note: what are we filling it with? sodas - orange soda, rootbeer, cola
            for (int i = 0; i <= 10; i++)
            {
                OrangeSoda orangeSoda = new OrangeSoda();
                _inventory.Add(orangeSoda);
            }

            for (int i = 0; i <= 10; i++)
            {
                RootBeer rootBeer = new RootBeer();
                _inventory.Add(rootBeer);
            }

            for (int i = 0; i <= 10; i++)
            {
                Cola cola = new Cola();
                _inventory.Add(cola);
            }
        }
示例#19
0
        private double GetSodaCost(string soda)
        {
            Can can;

            switch (soda)
            {
            case "Cola":
                can = new Cola();
                return(can.Cost);

            case "Root Beer":
                can = new RootBeer();
                return(can.Cost);

            case "Orange Soda":
                can = new OrangeSoda();
                return(can.Cost);
            }
            return(-1);
        }
示例#20
0
        //A method to fill the sodamachines inventory with soda can objects.
        public void FillInventory()
        {
            Cola       cola     = new Cola();
            RootBeer   rootBeer = new RootBeer();
            OrangeSoda orange   = new OrangeSoda();

            for (int i = 0; i < 100; i++)
            {
                _inventory.Add(cola);
            }

            for (int i = 0; i < 100; i++)
            {
                _inventory.Add(rootBeer);
            }

            for (int i = 0; i < 100; i++)
            {
                _inventory.Add(orange);
            }
        }
示例#21
0
        public static string SodaPrompt()
        {
            Can    cola     = new Cola();
            Can    rootbeer = new RootBeer();
            Can    orange   = new OrangeSoda();
            string output   = "";

            do
            {
                Console.WriteLine("Please choose a soda.");
                Console.WriteLine("1. " + cola.name);
                Console.WriteLine("2. " + rootbeer.name);
                Console.WriteLine("3. " + orange.name);
                int check = ValidInputNumeric(Console.ReadLine());
                if (check > 0 && check < 4)
                {
                    switch (check)
                    {
                    case 1:
                        output = cola.name;
                        break;

                    case 2:
                        output = rootbeer.name;
                        break;

                    case 3:
                        output = orange.name;
                        break;

                    default:
                        output = "";
                        break;
                    }
                }
            } while (output == "");
            return(output);
        }
示例#22
0
        //Constructor (Spawner)
        public SodaMachine()
        {
            _register  = new List <Coin>();
            _inventory = new List <Can>();

            RootBeer   rootBeer   = new RootBeer();
            Cola       cola       = new Cola();
            OrangeSoda orangeSoda = new OrangeSoda();

            FillInventory(20, rootBeer);
            FillInventory(20, cola);
            FillInventory(20, orangeSoda);

            Quarter quarter = new Quarter();
            Dime    dime    = new Dime();
            Nickel  nickel  = new Nickel();
            Penny   penny   = new Penny();

            FillRegister(20, quarter);
            FillRegister(10, dime);
            FillRegister(20, nickel);
            FillRegister(50, penny);
        }
        //Constructor (Spawner)
        public SodaMachine()
        {
            _register  = new List <Coin>();
            _inventory = new List <Can>();

            Quarter quarter = new Quarter();
            Dime    dime    = new Dime();
            Nickel  nickle  = new Nickel();
            Penny   penny   = new Penny();

            FillRegister(quarter, 20);
            FillRegister(dime, 10);
            FillRegister(nickle, 20);
            FillRegister(penny, 50);

            RootBeer   rootBeer   = new RootBeer();
            Cola       cola       = new Cola();
            OrangeSoda orangeSoda = new OrangeSoda();

            FillInventory(rootBeer, 10);
            FillInventory(cola, 10);
            FillInventory(orangeSoda, 10);
        }
示例#24
0
        //A method to fill the sodamachines inventory with soda can objects.
        public void FillInventory()
        {
            _inventory = new List <Can>();
            Can orangeSoda = new OrangeSoda();
            Can rootBeer   = new RootBeer();
            Can cola       = new Cola();

            _inventory.Add(orangeSoda);
            _inventory.Add(rootBeer);
            _inventory.Add(cola);

            for (int i = 0; i < 9; i++)
            {
                _inventory.Add(orangeSoda);
            }
            for (int i = 0; i < 5; i++)
            {
                _inventory.Add(rootBeer);
            }
            for (int i = 0; i < 6; i++)
            {
                _inventory.Add(cola);
            }
        }
 public static void DispenseDrink(RootBeer soda)
 {
     Console.WriteLine($"Thank you for choosing us for your beverage needs! Here comes your {soda.name}!");
 }
        public static RootBeer RootBeer()
        {
            RootBeer rootBeer = new RootBeer();

            return(rootBeer);
        }
示例#27
0
        //member methods
        public void AddRootBeerToBackpack()
        {
            RootBeer rootBeer = new RootBeer();

            cans.Add(rootBeer);
        }