private Dessert orderOneTypeDessert(Dessert dessert) { Console.WriteLine(); Console.WriteLine("Please type the name of the dessert."); string dessertName = Console.ReadLine(); dessert = dessert.getDessert(dessertName); while (dessert == null) { Console.WriteLine("Wrong dessert. Type again."); dessertName = Console.ReadLine(); dessert = new Dessert(); dessert = dessert.getDessert(dessertName); } Console.WriteLine(); Console.WriteLine("How many " + dessertName + "'s?"); string dessertNumber = Console.ReadLine(); int number = getNumberOfItems(ref dessertNumber); dessert.no = number; return(dessert); }
private void takeDessertOrder(Order order, ref string response, ref Dessert dessert) { if (isPositiveResponse(response)) { dessert = orderOneTypeDessert(dessert); order.desserts.Add(dessert); while (isPositiveResponse(response)) { Console.WriteLine("Do you want to order another dessert? (Y/N)"); response = Console.ReadLine(); if (isPositiveResponse(response)) { dessert = orderOneTypeDessert(dessert); order.desserts.Add(dessert); } } } }
public int takeOrder(Order order) { Console.WriteLine("Welcome to PizzaSIB!"); Console.WriteLine("Here's our pizza menu:"); Console.WriteLine(); Pizza pizza = new Pizza(); pizza.dispayPizzaNameAndPrice(); Console.WriteLine(); Console.WriteLine("Can I take your order?(Y/N)"); string response = Console.ReadLine(); takePizzaOrder(order, ref pizza, ref response); Console.WriteLine(); Console.WriteLine("Something to drink? (Y/N)"); Drinks drink = new Drinks(); drink.displayDrinkNameAndPrice(); response = Console.ReadLine(); takeDrinksOrder(order, ref response, ref drink); Console.WriteLine(); Console.WriteLine("Something sweet? (Y/N)"); Dessert dessert = new Dessert(); dessert.displayDessertNameAndPrice(); response = Console.ReadLine(); takeDessertOrder(order, ref response, ref dessert); int orderNumber = order.takeOrder(order); return(orderNumber); }