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); } }
public void RunSimulation(GrapeSoda grape, OrangeSoda orange, LemonSoda lemon) { Customer.DisplayUserAvailibleMoney(); CanSodaMachine.DisplayCurrentInventoryWithPrice(grape, orange, lemon); UserInput(grape, orange, lemon); Console.ReadLine(); }
public void AddLemonToInventory(int numberOfLemon) { for (int i = 0; i < numberOfLemon; i++) { LemonSoda lemon = new LemonSoda(); lemons.Add(lemon); } }
public void AddLemonSoda() { LemonSodas = new List <LemonSoda>(); for (int i = 0; i < 3; i++) { LemonSoda lemonSoda = new LemonSoda(); LemonSodas.Add(lemonSoda); } }
public void RemoveLemonFromInventory() { if (lemons.Count > 0) { LemonSoda lemon = new LemonSoda(); lemons.Remove(lemon); } else { Console.WriteLine("No Grape Soda Left."); } }
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); }
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); }