public static void BeginOrder() { Console.WriteLine("Please enter the number of BREADS you would like to order:"); int userBread = int.Parse(Console.ReadLine()); Console.WriteLine("Please enter the number of PASTRIES you would like to order:"); int userPastry = int.Parse(Console.ReadLine()); Bread newBread = new Bread(userBread); Pastry newPastry = new Pastry(userPastry); int orderTotal = newBread.BreadCalculator(newBread) + newPastry.PastryCalculator(newPastry); if (orderTotal >= 40) { orderTotal = (int)(orderTotal * 0.9); Console.WriteLine("-----------------------------------------------------------"); Console.WriteLine(newBread.BreadOrder + " BREAD will cost $" + newBread.BreadSubTotal + ".00"); Console.WriteLine(newPastry.PastryOrder + " PASTRY will cost $" + newPastry.PastrySubTotal + ".00"); Console.WriteLine("**You qualify for the 10% discount!**"); Console.WriteLine("Your grand total is: $" + orderTotal + ".00"); Console.WriteLine("-----------------------------------------------------------"); } else { Console.WriteLine("-----------------------------------------------------------"); Console.WriteLine(newBread.BreadOrder + " BREAD will cost $" + newBread.BreadSubTotal + ".00"); Console.WriteLine(newPastry.PastryOrder + " PASTRY will cost $" + newPastry.PastrySubTotal + ".00"); Console.WriteLine("Your grand total is: $" + orderTotal + ".00"); Console.WriteLine("-----------------------------------------------------------"); } }
public int PastryCalculator(Pastry newPastry) { for (int i = 1; i <= newPastry.PastryOrder; i++) { if (i % 3 == 0) { newPastry.PastrySubTotal += 1; } else { newPastry.PastrySubTotal += 2; } } return(newPastry.PastrySubTotal); }