static void Main(string[] args) { SodaMachine attempt = new SodaMachine(); attempt.Run(); Console.ReadKey(); }
//Takes a coin from wallet and puts it into the temporary payment list public void AddCoinToPayment(Coin coin, Customer customer, SodaMachine sodaMachine) { payment.Add(coin); customer.wallet.coins.Remove(coin); UserInterface.MenuTwo(customer, sodaMachine); }
public Customer() { wallet = new Wallet(); backpack = new BackPack(); payment = new List <Coin>(); sodaMachine = new SodaMachine(); }
static void Main(string[] args) { SodaMachine sodaMachine = new SodaMachine(); sodaMachine.Run(); //Test Case 1 //List<Coin> myMoney = new List<Coin>(); //myMoney.Add(new Quarter()); //myMoney.Add(new Quarter()); //myMoney.Add(new Nickel()); //sodaMachine.MakeTransaction(myMoney, new LemonSoda()); //Test Case 2 //List<Coin> myMoney = new List<Coin>(); //myMoney.Add(new Quarter()); //myMoney.Add(new Quarter()); //myMoney.Add(new Nickel()); //sodaMachine.MakeTransaction(myMoney, new GrapeSoda()); //Test Case 2 List <Coin> myMoney = new List <Coin>(); myMoney.Add(new Quarter()); myMoney.Add(new Quarter()); myMoney.Add(new Quarter()); myMoney.Add(new Nickel()); sodaMachine.MakeTransaction(myMoney, new GrapeSoda()); Console.ReadKey(); }
static void Main(string[] args) { SodaMachine sodaMachine = new SodaMachine(); sodaMachine.SetMachineName("Hello"); List <Coin> someCoins = new List <Coin>(); sodaMachine.CompletePurchase(someCoins); }
static void Main(string[] args) { var sm = new SodaMachine(); while (true) { sm.HandleCommand(Console.ReadLine()); } }
static void Main(string[] args) { SodaMachine machine = new SodaMachine(); machine.ActivateSodaMachine(); Console.ReadKey(); }
public Simulation() { sodaMachine = new SodaMachine(); customer = new Customer(); UserInterface.Welcome(); string paymentChoice = UserInterface.ChoosePayment(); PaymentChoice(paymentChoice); }
public Simulation() { sodaMachine = new SodaMachine(); customer = new Customer(); customer.InsertMoney(); //need method to calculate "running total" of coin values //Can can = UserInterface.WhatDrink(sodaMachine); //CheckMoney(can, sodaMachine.temporaryRegister); }
public Simulation() { sodaMachine = new SodaMachine(); customer = new Customer(); payment = new List <Coin>(); sodaSelection = ""; transactionSuccess = false; paymentSuccess = false; selectionSuccess = false; }
public static void DisplayWalletContents(Customer customer, SodaMachine sodaMachine) { Console.WriteLine($"You have ${customer.CheckWalletCoinValue()} in coins"); customer.CheckWalletCoinCount(); Console.WriteLine($"You have {customer.QuarterCount} Quarters"); Console.WriteLine($"You have {customer.DimeCount} Dimes"); Console.WriteLine($"You have {customer.NickelCount} Nickels"); Console.WriteLine($"You have {customer.PennyCount} Pennies"); Console.WriteLine(""); MainMenu(customer, sodaMachine); }
public Simulation() { sodaMachine = new SodaMachine(); customer = new Customer(); sodaMachine.StartingInventory(10, 10, 10); //sodaMachine.StartingRegister(20,10,20,50); customer.wallet.StartingWallet(12, 15, 8, 10); Menu(); UserInterface.DisplaySodaInBackpack(customer.backpack.cans); }
static void Main(string[] args) { // SodaMachine sellASoda = new SodaMachine(); // sellASoda.SellASoda(); UserInterface.MakeASelection(); //UserInterface.PayWithCoin(); SodaMachine sellASoda = new SodaMachine(); // sellASoda.SellASoda(); Console.ReadLine(); }
public static void ShowSodaMachineStuff(SodaMachine sodaMachine) { Console.ForegroundColor = ConsoleColor.DarkYellow; string title = "\nThe Soda Machine inventory"; int[] sodaQty = Functions.CanListCount(sodaMachine.inventory); int[] coinQty = Functions.CoinListCount(sodaMachine.register); double payment = sodaMachine.paymentTotal(); UserInterface.SodaMachineInventoryDisplay(sodaQty, coinQty, title, payment); Console.ForegroundColor = ConsoleColor.White; }
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(); }
//member methods public void Run() { sodaMachine = new SodaMachine(); customer = new Customer(); UserInterface.DisplayText("Welcome to Treml's vending service"); do { UserInterface.ShowSodaMachineStuff(sodaMachine); sodaMachine.Menu(); UserInterface.ShowCustomersStuff(customer); PickPaymentType(); //Console.Clear(); //comment this for deguging for history of transactions UserInterface.ShowSodaMachineStuff(sodaMachine); UserInterface.ShowCustomersStuff(customer); leave = UserInterface.LeaveSodaMachine(); } while (leave != "q"); }
public static void DisplayBackpackContents(Customer customer, SodaMachine sodaMachine) { if (customer.backpack.cans == null) { Console.Clear(); Console.WriteLine("Backpack is Currently Empty"); MainMenu(customer, sodaMachine); } else { Console.WriteLine("Backpack Contains"); Console.WriteLine($"{customer.ColaCount} Cola Cans"); Console.WriteLine($"{customer.OrangeCount} Orange Cans"); Console.WriteLine($"{customer.RootbeerCount} Root Beer Cans"); Console.WriteLine(""); MainMenu(customer, sodaMachine); } }
public static void MenuTwo(Customer customer, SodaMachine sodaMachine) { Console.Clear(); Console.WriteLine($"You have deposited ${sodaMachine.PaymentValue()}"); Console.WriteLine(""); Console.WriteLine("What would you like to do?"); Console.WriteLine("1. Make a Selection"); Console.WriteLine("2. Deposit Additional Coins"); Console.WriteLine("3. Return to Main Menu"); Console.WriteLine("4. Leave Soda Machine"); string userInput = Console.ReadLine(); switch (userInput) { case "1": DisplayAvailableCans(customer, sodaMachine); break; case "2": Console.Clear(); customer.CheckWalletCoinCount(); DepositCoinsMenu(customer, sodaMachine); break; case "3": MainMenu(customer, sodaMachine); break; case "4": Environment.Exit(0); break; default: Console.Clear(); Console.WriteLine("Invalid Response, Please try again"); Console.WriteLine(); MenuTwo(customer, sodaMachine); break; } }
//Checks to see if Transaction Can Continue based on Scenarios from User Stories public void CheckTransaction(Customer customer, string canName, SodaMachine sodaMachine) { if (CheckInventory(canName)) { Can desiredCan = GetDesiredCan(canName); if (PaymentValue() == desiredCan.SodaCost) { DistributeCan(desiredCan, customer); customer.CheckBackpackStock(); DepositPaymentInRegister(); UserInterface.MainMenu(customer, sodaMachine); } else if (PaymentValue() < desiredCan.SodaCost) { UserInterface.DisplayMessage("Insufficent Funds Deposited, Come back when you can afford it"); ReturnCoinsToWallet(customer); UserInterface.MainMenu(customer, sodaMachine); } else if (PaymentValue() > desiredCan.SodaCost && SufficientChangeExists(desiredCan, customer)) { DistributeCan(desiredCan, customer); customer.CheckBackpackStock(); DepositPaymentInRegister(); GiveChange(desiredCan, customer); UserInterface.MainMenu(customer, sodaMachine); } else if (PaymentValue() > desiredCan.SodaCost && !SufficientChangeExists(desiredCan, customer)) { UserInterface.DisplayMessage("Please use correct change and try the transaction again."); ReturnCoinsToWallet(customer); UserInterface.MainMenu(customer, sodaMachine); } } else { UserInterface.DisplayMessage("Item of stock"); ReturnCoinsToWallet(customer); UserInterface.MainMenu(customer, sodaMachine); } }
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(); }
//Member Variables //Constructor //Methods public static void MainMenu(Customer customer, SodaMachine sodaMachine) { Console.WriteLine("1. Make a Purchase"); Console.WriteLine("2. View Wallet Contents"); Console.WriteLine("3. View Backpack Contents"); Console.WriteLine("4. Leave the Soda Machine"); string userInput = Console.ReadLine(); switch (userInput) { case "1": MenuTwo(customer, sodaMachine); break; case "2": Console.Clear(); DisplayWalletContents(customer, sodaMachine); break; case "3": Console.Clear(); DisplayBackpackContents(customer, sodaMachine); break; case "4": Environment.Exit(0); break; default: Console.Clear(); Console.WriteLine("Invalid Response, Please try again"); Console.WriteLine(); MainMenu(customer, sodaMachine); break; } }
public static void DisplayAvailableCans(Customer customer, SodaMachine sodaMachine) { Console.WriteLine("Which item would you like to purchase?"); Console.WriteLine(); Console.WriteLine("1. Cola - $.35"); Console.WriteLine("2. Orange - $.06"); Console.WriteLine("3. Root Beer - $.60"); Console.WriteLine("4. Return to Main Menu"); string userInput = Console.ReadLine(); switch (userInput) { case "1": sodaMachine.CheckTransaction(customer, "Cola", sodaMachine); break; case "2": sodaMachine.CheckTransaction(customer, "Orange", sodaMachine); break; case "3": sodaMachine.CheckTransaction(customer, "Root Beer", sodaMachine); break; case "4": MainMenu(customer, sodaMachine); break; default: Console.Clear(); Console.WriteLine("Invalid Response, Please try again"); Console.WriteLine(); DisplayAvailableCans(customer, sodaMachine); break; } }
//constructor public Simulation() { customer = new Customer(); sodaMachine = new SodaMachine(); }
static void Main(string[] args) { SodaMachine sodaMachine = new SodaMachine(); sodaMachine.sodaSelectWindow(); }
//constructor public RestStop() { machine = new SodaMachine(); }
//Constuctor public Simulation() { sodaMachine = new SodaMachine(20, 10, 20, 50, 5, 5, 10); customer = new Customer(); }
public Simulation() { soadMachine = new SodaMachine(); customer = new Customer(); }
public Simulation(SodaMachine machine, Customer customer) { sodaMachine = machine; this.customer = customer; }
public static void DepositCoinsMenu(Customer customer, SodaMachine sodaMachine) { Console.WriteLine("Which Coin Type would you like to deposit?"); Console.WriteLine(""); Console.WriteLine($"1. Quarter: {customer.QuarterCount} available"); Console.WriteLine($"2. Dime: {customer.DimeCount} available"); Console.WriteLine($"3. Nickel: {customer.NickelCount} available"); Console.WriteLine($"4. Penny: {customer.PennyCount} available"); Console.WriteLine("5. Proceed to Selection Menu"); string userInput = Console.ReadLine(); switch (userInput) { case "1": if (customer.QuarterCount > 0) { sodaMachine.AddCoinToPayment(customer.GetDesiredCoin("Quarter"), customer, sodaMachine); break; } else { UserInterface.DisplayMessage("You do not have any quarters, please try again"); DepositCoinsMenu(customer, sodaMachine); break; } case "2": if (customer.DimeCount > 0) { sodaMachine.AddCoinToPayment(customer.GetDesiredCoin("Dime"), customer, sodaMachine); break; } else { UserInterface.DisplayMessage("You do not have any dimes, please try again"); DepositCoinsMenu(customer, sodaMachine); break; } case "3": if (customer.NickelCount > 0) { sodaMachine.AddCoinToPayment(customer.GetDesiredCoin("Nickel"), customer, sodaMachine); break; } else { UserInterface.DisplayMessage("You do not have any nickels, please try again"); DepositCoinsMenu(customer, sodaMachine); break; } case "4": if (customer.PennyCount > 0) { sodaMachine.AddCoinToPayment(customer.GetDesiredCoin("Penny"), customer, sodaMachine); break; } else { UserInterface.DisplayMessage("You do not have any pennies, please try again"); DepositCoinsMenu(customer, sodaMachine); break; } case "5": DisplayAvailableCans(customer, sodaMachine); break; default: Console.Clear(); Console.WriteLine("Invalid Response, Please try again"); Console.WriteLine(); MenuTwo(customer, sodaMachine); break; } }
public Simulation() { sodaMachine = new SodaMachine(); customer = new Customer(); coinsInHand = new List <Coin>(); }