コード例 #1
0
ファイル: Program.cs プロジェクト: ebezjian/Bakery
        static void Main()
        {
            Console.WriteLine("Bonjour mon petite ami, welcome to Pierre's Bakery! Today we have fresh bread and pastries!");
            Console.WriteLine("We have a special on loaves of bread today. They are $5 each, but buy two and get one for free!");
            Console.WriteLine(" I know, I am so generous. How many would you like?");
            string uBreadQuantity = Console.ReadLine();
            int    BreadQuantity  = int.Parse(uBreadQuantity);

            Console.WriteLine("Excellent choice. Now how about pastries? Will you eat cake? We have a special for them as well, $2 each or 3 for $5.");
            Console.WriteLine("Please, I know it's such a great deal but contain your excitement. How many would you like?");
            string uPastryQuantity = Console.ReadLine();
            int    PastryQuantity  = int.Parse(uPastryQuantity);
            Bread  uBread          = new Bread(5, BreadQuantity);
            Pastry uPastry         = new Pastry(2, PastryQuantity);
            int    BreadTotal      = uBread.OrderAmount();
            int    PastryTotal     = uPastry.PastryOrder();
            int    FinalTotal      = BreadTotal + PastryTotal;

            Console.WriteLine($"Merveilleux! your order was for {uBreadQuantity} loaves of bread and {uPastryQuantity} delectable pastries. Your total will be ${FinalTotal}.");
            Console.WriteLine("But you know mon petite ami, I've decided that you are a treat in ofteself so here, take it for free. Viva La Treats!");
        }
コード例 #2
0
        static void Main()
        {
            Console.WriteLine("Welcome to Pierre's Bakery. Today we have fresh baked bread and pastires!");
            Console.WriteLine("What's your name valued customer?");
            string name = Console.ReadLine();

            Console.WriteLine("We have two kind of bread today: French for $5 and Sourdough for $10. Which kind would you like?");
            string bread = Console.ReadLine();

            bread = char.ToUpper(bread[0]) + bread.Substring(1);
            Console.WriteLine($"And how many loaves of {bread} bread would you like?");
            int   breadAmount = int.Parse(Console.ReadLine());
            Bread breadOrder  = new Bread();
            int   breadCost   = breadOrder.TypeOfBread(bread, breadAmount);

            Console.WriteLine($"Sounds good! {breadAmount} loaves of {bread} bread. How many pastries can I get for you? Today they are $2 each or 3 for $5.");
            int    pastry      = int.Parse(Console.ReadLine());
            Pastry pastryOrder = new Pastry(pastry);

            Console.WriteLine($"So for {breadAmount} loaves of {bread}bread and {pastry} pastries your total comes out to ${breadCost + pastryOrder.OrderCost()}. Cash or Card today?");
            string paymentMethod = Console.ReadLine();

            Console.WriteLine(Payment(paymentMethod, name));
        }