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); }
public void AddOrangeToSelectedCans() { OrangeSoda orange = new OrangeSoda(); selectedCans.Add(orange); totalBill += orange.Cost; }
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); }
public void RunSimulation(GrapeSoda grape, OrangeSoda orange, LemonSoda lemon) { Customer.DisplayUserAvailibleMoney(); CanSodaMachine.DisplayCurrentInventoryWithPrice(grape, orange, lemon); UserInput(grape, orange, lemon); Console.ReadLine(); }
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"); } }
public void UserInput(GrapeSoda grapeSoda, OrangeSoda orangeSoda, LemonSoda lemonSoda) { Console.WriteLine("Pick a soda: Type 1 for Grapesoda, 2 for Orangesoda, or 3 for Lemonsoda"); string userInput = Console.ReadLine(); if (userInput == "1" && Customer.Wallet.Money >= grapeSoda.Value && CanSodaMachine.Inventory.GrapeSodas.Count > 0) { Customer.BuySoda(grapeSoda.Value); CanSodaMachine.Inventory.GrapeSodas.Remove(grapeSoda); } else if (userInput == "2" && Customer.Wallet.Money >= orangeSoda.Value && CanSodaMachine.Inventory.OrangeSodas.Count > 0) { Customer.BuySoda(orangeSoda.Value); CanSodaMachine.Inventory.OrangeSodas.Remove(orangeSoda); } else if (userInput == "3" && Customer.Wallet.Money >= lemonSoda.Value && CanSodaMachine.Inventory.LemonSodas.Count > 0) { Customer.BuySoda(lemonSoda.Value); CanSodaMachine.Inventory.LemonSodas.Remove(lemonSoda); } else { Console.WriteLine("wrong input"); UserInput(grapeSoda, orangeSoda, lemonSoda); } }
void FillBackBack() { can = new List <Can>(); orangeSoda = new OrangeSoda(); rootBeer = new RootBeer(); cola = new Cola(); }
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); } }
private void FillOrangeSoda(int startingOrangeSoda) { for (int i = 0; i < startingOrangeSoda; i++) { OrangeSoda orangeSoda = new OrangeSoda(); _inventory.Add(orangeSoda); } }
private void StockOrangeSoda() { for (int i = 0; i < 10; i++) { OrangeSoda orangeSoda = new OrangeSoda(); inventory.Add(orangeSoda); } }
public void AddOrange(int count) { for (int i = 0; i < count; i++) { Can can = new OrangeSoda(); inventory.Add(can); } }
public void AddOrangeToInventory(int numberOfOrange) { for (int i = 0; i < numberOfOrange; i++) { OrangeSoda orange = new OrangeSoda(); oranges.Add(orange); } }
public void AddOrageSoda() { OrangeSodas = new List <OrangeSoda>(); for (int i = 0; i < 6; i++) { OrangeSoda orangeSoda = new OrangeSoda(); OrangeSodas.Add(orangeSoda); } }
//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); }
public void DisplayCurrentInventoryWithPrice(GrapeSoda grape, OrangeSoda orangeSoda, LemonSoda lemonSoda) { //Why does C# not print zero at the behinde the decimal point Console.WriteLine($"Gape cost: ${grape.Value} cents"); Console.WriteLine($"Organge cost: ${orangeSoda.Value} cents"); Console.WriteLine($"Lemon cost: ${lemonSoda.Value} cents"); Console.WriteLine("Gape Soda in Inventory: " + Inventory.GrapeSodas.Count); Console.WriteLine("Orange Soda in Inventory: " + Inventory.OrangeSodas.Count); Console.WriteLine("Lemon Soda in Inventory: " + Inventory.LemonSodas.Count); }
public void RemoveOrangeFromInventory() { if (oranges.Count > 0) { OrangeSoda orange = new OrangeSoda(); oranges.Remove(orange); } else { Console.WriteLine("No Orange Soda Left."); } }
//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); } }
static void Main(string[] args) { GrapeSoda grape = new GrapeSoda(); OrangeSoda orangeSoda = new OrangeSoda(); LemonSoda lemonSoda = new LemonSoda(); //Customer customer = new Customer(); //CanSodaMachine canSodaMachine = new CanSodaMachine(); //customer.DisplayUserAvailibleMoney(); //canSodaMachine.DisplayCurrentInventoryWithPrice(grape, orangeSoda, lemonSoda); //Console.ReadLine(); Simulation simulation = new Simulation(); simulation.RunSimulation(grape, orangeSoda, lemonSoda); }
static void Main(string[] args) { SodaMachine testMachine = new SodaMachine(); Customer testCustomer = new Customer(); double testDouble = .20; Can testCan = new OrangeSoda(); List <Coin> testList = new List <Coin>(); Wallet testWallet = new Wallet(); //bool enoughMoneyForPurchase = testMachine.EnoughMoneyForPurchase(testDouble, testCan); //testMachine.ReturnMoneyToCustomer(testList, testCustomer); //testWallet.AddCoinstoWallet(); //testMachine.AddCoinstoMachine(); }
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); } }
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); } }
//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 }
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); } }
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); } }
//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); } }
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); }
//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); } }
//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); } }
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); }
//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); }