Ejemplo n.º 1
0
        public static string PastryMenu()
        {
            string pastryType;
            string menuOption = "p";

            Console.Write(
                @"                  
                  
                        Select kind of pastry you'd like:
                       ------------------------------------                       
                                [C]roissant - $2.00
                                [M]uffin - $2.50
                                C[O]okie - $1.50
                       ------------------------------------         
                        (*Croissants are 1 for $2, 3 for $5
                          Must add 3 to your cart to get the deal
                          All deals are applied on checkout)
                                
                                        ");



            pastryType = Console.ReadLine().ToLower();

            Pastry.PastryPrice(pastryType);

            Console.Write(
                @"                            Please enter quantity:

                                
                                ");
            int amount = int.Parse(Console.ReadLine());

            Pastry tempBread = new Pastry(pastryType, amount);
            string tempName  = tempBread.PastryName(pastryType);

            Console.WriteLine(
                $@"                         
                          {amount} {tempName}s added to your cart.");
            Console.Write(
                @"                         
                          If you'd like to see our bread menu, press [B].
                          If you'd like to checkout, press [T]otal.
                          If you'd like to buy more pastries, press enter.


                                ");
            string selection = Console.ReadLine().ToLower();

            if (selection == "b")
            {
                menuOption = selection;
            }
            else if (selection == "t")
            {
                menuOption = selection;
            }

            return(menuOption);
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            try
            {
                Console.WriteLine("Please enter the number of Loaves you'd like.");
                Console.WriteLine("Bread is 5 Ruppees a loaf and buy 2, get 1 free!");
                string breadOrder       = Console.ReadLine();
                int    breadOrderNumber = Int32.Parse(breadOrder);
                Bread  loaves           = new Bread(breadOrderNumber);

                Console.WriteLine("Please enter the number of Pastries you'd like.");
                Console.WriteLine("Pastries are 2 Ruppees each, or 3 for 5!");
                string pastryOrder       = Console.ReadLine();
                int    pastryOrderNumber = Int32.Parse(pastryOrder);
                Pastry pastries          = new Pastry(pastryOrderNumber);
                Console.WriteLine("The Price for Bread is: " + " " + loaves.BreadPrice() + " " + "Ruppees");
                Console.WriteLine("The Price for Pastries is: " + " " + pastries.PastryPrice() + " " + "Ruppees");
                Order total = new Order(loaves.BreadPrice(), pastries.PastryPrice());
                Console.WriteLine("The Total Price of Your Order is: " + " " + total.OrderTotal + " " + "Ruppees");
                Console.WriteLine("If you would like to place another order, enter Y, all other input will end program.");
                string cont = Console.ReadLine();
                if (cont == "Y")
                {
                    Console.WriteLine("Here We Go Again!");
                    Main();
                }
                else
                {
                    Console.WriteLine("Thanks for Stopping By! There's Monsters Out There, Travel Safe!");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + " " + "Please Pay Attention to the Prompts. Only The Suggested Inputs are Valid");
                Main();
            }
        }