示例#1
0
        public static void Main()
        {
            string intro = "Hello and Welcome to Pierre's Bakery.\n" +
                           "Today we have fresh bread for $5 a loaf.\n" +
                           "We also have delecious pasteries for just $2 a peice\n" +
                           "Feeling Hungry? well check out our deals: \n " +
                           "\n" +
                           "Bread is buy 2 get one free // Pastery of your choice 3 for $5!\n";
            string title = @"

       ___  __  ___  ___   ___   ___  _  ___    ___   __   _ _   ___  ___  
(  ,\(  )(  _)(  ,) (  ,) (  _)/_)/ __)  (  ,) (  ) ( ) ) (  _)(  ,) ( \/ )
 ) _/ )(  ) _) )  \  )  \  ) _)   \__ \   ) ,\ /__\  )  \  ) _) )  \  \  / 
(_)  (__)(___)(_)\_)(_)\_)(___)   (___/  (___/(_)(_)(_)\_)(___)(_)\_)(__/  ";

            Console.WriteLine(title);
            Console.WriteLine();
            Console.WriteLine(intro);
            Console.Write("Enter how many loafs you would like: ");
            int loafs = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter how many Pasteries you would like: ");
            int     sweets       = Convert.ToInt32(Console.ReadLine());
            Bread   breadOrder   = new Bread(loafs);
            Pastery sweetOrder   = new Pastery(sweets);
            int     billTotal    = sweetOrder.PasteryRegPrice() + breadOrder.BreadRegPrice();
            int     salePrice    = breadOrder.BreadSale() + sweetOrder.PasterySale();
            int     ammountSaved = billTotal - salePrice;

            Console.WriteLine();
            Console.WriteLine($"Bill total:\t{billTotal,8:c}");
            Console.WriteLine($"You Saved:\t{ammountSaved,8:c}");
            Console.WriteLine(("").PadRight(24, '-'));
            Console.WriteLine($"Grand total:\t{salePrice,8:c}");
        }
示例#2
0
        public static void Main()
        {
            Bread   loaf      = new Bread();
            Pastery croissant = new Pastery();
            Order   newOrder  = new Order();

            Console.WriteLine("----------------------------------------------\nWelcome To Pierre's Bakery!\nWe currently have two deals:\nBuy 2 loafs, get 1 free. A single loaf costs $4.\n Buy 1 croissant for $2 or 3 for $5.\n----------------------------------------------\n");

            Order.NewOrder(loaf, croissant);
        }
示例#3
0
        public static void NewOrder(Bread loaf, Pastery croissant)
        {
            Console.WriteLine("Would you like to purchase bread or a pastery, or view your basket? (bread/pastery/basket)");
            string userInput = Console.ReadLine();

            if (userInput.ToLower() == "view" || userInput.ToLower() == "basket")
            {
                Console.WriteLine("--------------------------------\nYour order:\n" + loaf.Quantity + " bread item(s) and " + croissant.Quantity + " pastery item(s).");
                loaf.CalculatePrice();
                croissant.CalculatePrice();
                Console.WriteLine("Your total is $ " + (loaf.Total + croissant.Total) + ".\n--------------------------------");
                Console.WriteLine("Would you like to exit program? (exit/continue)");
                string userContinue = Console.ReadLine();
                if (userContinue.ToLower() == "continue")
                {
                    NewOrder(loaf, croissant);
                }
            }
            else if (userInput.ToLower() == "bread")
            {
                Console.WriteLine("You have ordered a " + loaf.Name + " of bread.");
                Console.WriteLine("It will cost $" + loaf.Price);
                loaf.AddOne();
                Console.WriteLine("You currently have " + loaf.Quantity + " bread item(s)");
                NewOrder(loaf, croissant);
            }
            else if (userInput.ToLower() == "pastery")
            {
                Console.WriteLine("You have ordered a " + croissant.Name + " of bread.");
                Console.WriteLine("It will cost $" + croissant.Price);
                croissant.AddOne();
                Console.WriteLine("You currently have " + croissant.Quantity + " pastery item(s)");
                NewOrder(loaf, croissant);
            }
            else
            {
                Console.WriteLine("We could not understand your order, please re-enter either 'bread' or 'pastery'.");
                NewOrder(loaf, croissant);
            }
        }