Ejemplo n.º 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);
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 void FillBackBack()
 {
     can        = new List <Can>();
     orangeSoda = new OrangeSoda();
     rootBeer   = new RootBeer();
     cola       = new Cola();
 }
Ejemplo n.º 5
0
        public void AddColaToSelectedCans()
        {
            Cola cola = new Cola();

            selectedCans.Add(cola);
            totalBill += cola.Cost;
        }
Ejemplo n.º 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");
            }
        }
Ejemplo n.º 7
0
 public void AddCola(int count)
 {
     for (int i = 0; i < count; i++)
     {
         Can can = new Cola();
         inventory.Add(can);
     }
 }
Ejemplo n.º 8
0
 private void StockCola()
 {
     for (int i = 0; i < 8; i++)
     {
         Cola cola = new Cola();
         inventory.Add(cola);
     }
 }
Ejemplo n.º 9
0
 private void FillCola(int startCola)
 {
     for (int i = 0; i < startCola; i++)
     {
         Cola cola = new Cola();
         _inventory.Add(cola);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 12
0
        public void AddCansToMachine()
        {
            //create a for loop to add the coins
            for (int i = 0; i < 10; i++)
            {
                OrangeSoda orangeSoda = new OrangeSoda();
                inventory.Add(orangeSoda);
                Cola cola = new Cola();
                inventory.Add(cola);
            }

            for (int i = 0; i < 7; i++)
            {
                Rootbeer rootbeer = new Rootbeer();
                inventory.Add(rootbeer);
            }
        }
Ejemplo n.º 13
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);
     }
 }
Ejemplo n.º 14
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);
     }
 }
Ejemplo n.º 15
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);
     }
 }
Ejemplo n.º 16
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
        }
Ejemplo n.º 17
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);
     }
 }
Ejemplo n.º 18
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());
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 20
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);
            }
        }
Ejemplo n.º 21
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);
            }
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
0
        static void Main(string[] args)
        {
            SodaMachine test = new SodaMachine();
            Simulation  sim  = new Simulation();

            //Coin test
            test.register.ForEach(Console.WriteLine);
            Console.ReadLine();
            Console.WriteLine(test.register.ElementAt(2).Amount + " " + test.register.ElementAt(2).name);
            Console.ReadLine();

            //Can Test
            test.inventory.ForEach(Console.WriteLine);
            Console.ReadLine();
            Console.WriteLine(test.inventory.ElementAt(2).Cost + " " + test.inventory.ElementAt(2).name);
            Console.ReadLine();

            //Dispense Test
            Can coke = new Cola();

            sim.CheckMoney(coke, sim.customer.wallet.SelectedCoins(), sim.customer.InsertMoney());
            Console.ReadLine();
        }
Ejemplo n.º 25
0
        //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);
        }
Ejemplo n.º 26
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);
            }
        }
 // Dispense Drink
 public static void DispenseDrink(Cola soda)
 {
     Console.WriteLine($"Thank you for choosing us for your beverage needs! Here comes your {soda.name}!");
 }
Ejemplo n.º 28
0
        //Gets a soda from the inventory based on the name of the soda.
        private Can GetSodaFromInventory(string nameOfSoda)
        {
            Can GetSodaFromInventory = new Cola();

            return(GetSodaFromInventory);
        }
        // Member Variables


        // Member Methods
        // Can Builders
        public static Cola Cola()
        {
            Cola cola = new Cola();

            return(cola);
        }
Ejemplo n.º 30
0
        public void AddColaToBackpack()
        {
            Cola cola = new Cola();

            cans.Add(cola);
        }