Пример #1
0
    public static void Main()
    {
        Console.WriteLine("");
        Console.WriteLine("Hello there! Welcome to Joe's bakery. We have the following specials: ");
        Console.WriteLine("");
        Console.WriteLine("1. Bread is 5 Dollars per Loaf. Buy 2 get 1 free!");
        Console.WriteLine("2. Pastries are 2 Dollars each, or 3 for 5 Dollars!");
        Console.WriteLine("");
        Console.WriteLine("Enter the number of bread loafs you'd like to purchase: ");
        int        breadLoafs    = int.Parse(Console.ReadLine());
        BreadOrder newBreadOrder = new BreadOrder(breadLoafs);

        Console.WriteLine("Enter the number of pastries you'd like to purchase: ");
        int         pastries       = int.Parse(Console.ReadLine());
        PastryOrder newPastryOrder = new PastryOrder(pastries);

        Console.WriteLine("");
        Console.WriteLine("The cost of your bread order is: ");
        Console.WriteLine(newBreadOrder.OrderCost() + " Dollars");
        Console.WriteLine("The cost of your pastry order is: ");
        Console.WriteLine(newPastryOrder.OrderCost() + " Dollars");
        OrderCalculator newOrderCalculator = new OrderCalculator();

        Console.WriteLine("");
        Console.WriteLine("The total cost of your order is: ");
        Console.WriteLine(newOrderCalculator.TotalCost(newBreadOrder.OrderCost(), newPastryOrder.OrderCost()) + " Dollars");
    }
Пример #2
0
        public static void Main()
        {
            Console.WriteLine("Welcome to Pierres Bakery.");
            Console.WriteLine("We offer Pastrys and Bread!");
            Console.WriteLine("Here are our deals currently:");
            Console.WriteLine("Bread - Buy 2, get 1 free. A single loaf costs $5.");
            Console.WriteLine("Pastry's - Buy 1 for $2 or 3 for $5.");
            Console.WriteLine("**Special Today Only** Pastry's - Buy 5 for $7");
            Console.WriteLine("--------------------------------------------------");

            Console.WriteLine("How many Pastry's would you like?");
            int pastryWanted = int.Parse(Console.ReadLine());

            Console.WriteLine("How many loaves of Bread would you like?");
            int breadWanted = int.Parse(Console.ReadLine());

            PastryOrder pastry = new PastryOrder();
            BreadOrder  bread  = new BreadOrder();

            pastry.PastryCheckout(pastryWanted);

            bread.BreadCheckout(breadWanted);

            Console.WriteLine("Pastry Received: " + pastry.PastryAmount);
            Console.WriteLine("Pastry Price: " + pastry.PastryPrice + "$");

            Console.WriteLine("Bread Received: " + bread.BreadAmount);
            Console.WriteLine("Bread Price: " + bread.BreadPrice + "$");

            int total = bread.BreadPrice + pastry.PastryPrice;

            Console.WriteLine("Your total today will be: " + total + "$");
        }
Пример #3
0
        public static void Start()
        {
            Console.WriteLine("How many loaves of Bread would you like?");
            BreadOrder newBreadOrder = new BreadOrder(int.Parse(Console.ReadLine()));

            if (newBreadOrder.IsOnlyPositiveNumberCharacters())
            {
                Console.WriteLine("Here is your bread order total: $" + (newBreadOrder.GetBreadTotal()));
            }
            else
            {
                Console.WriteLine("Please enter a positive number");
                Start();
            }

            Console.WriteLine("How many pastries would you like?");
            PastryOrder newPastryOrder = new PastryOrder(int.Parse(Console.ReadLine()));

            if (newPastryOrder.IsOnlyPositiveNumberCharacters2())
            {
                Console.WriteLine("Here is your pastry order total: $" + (newPastryOrder.GetPastryTotal()));
            }
            else
            {
                Console.WriteLine("Please enter a positive number");
                Start();
            }

            Console.WriteLine("Here is your grand total: $" + (newBreadOrder.GetBreadTotal() + newPastryOrder.GetPastryTotal()));
        }
Пример #4
0
        public void Bread_InstantiateObject_Int()
        {
            int        breadAmount = 0;
            BreadOrder newBread    = new BreadOrder(breadAmount);
            int        result      = newBread.BreadAmount;

            Assert.AreEqual(breadAmount, result);
        }
Пример #5
0
        public void BreadOrder_CreateInstanceOfBreadOrder_BreadOrder()
        {
            int numberOfLoafs = 2;

            BreadOrder newBreadOrder = new BreadOrder(numberOfLoafs);

            Assert.AreEqual(typeof(BreadOrder), newBreadOrder.GetType());
        }
Пример #6
0
        public void PriceCalc_ReturnPrice_Int6()
        {
            int        BreadAmount = 1;
            int        price       = 5;
            BreadOrder newBread    = new BreadOrder(BreadAmount);
            int        result      = BreadOrder.PriceCalc(BreadAmount);

            Assert.AreEqual(price, result);
        }
Пример #7
0
        public void Bread_OddReturnsAmountPrice_Int()
        {
            int        amount    = 11;
            BreadOrder newBakery = new BreadOrder();

            newBakery.BreadCheckout(amount);
            int price = newBakery.BreadPrice;

            Assert.AreEqual(55, price);
        }
Пример #8
0
        public void Bread_EvenReturnsBreadAmount_Int()
        {
            int        amount    = 10;
            BreadOrder newBakery = new BreadOrder();

            newBakery.BreadCheckout(amount);
            int loaves = newBakery.BreadAmount;

            Assert.AreEqual(15, loaves);
        }
Пример #9
0
        public void OrderCost_CalculateCostOfBreadOrderWithDiscount_int()
        {
            int numberOfLoafs     = 3;
            int intendedOrderCost = 10;

            BreadOrder newBreadOrder  = new BreadOrder(numberOfLoafs);
            int        breadOrderCost = newBreadOrder.OrderCost();

            Assert.AreEqual(intendedOrderCost, breadOrderCost);
        }
Пример #10
0
        public void BreadOrder_SetCostPerLoafTo5_int()
        {
            int numberOfLoafs       = 2;
            int intendedCostPerLoaf = 5;

            BreadOrder newBreadOrder = new BreadOrder(numberOfLoafs);
            int        costPerLoaf   = newBreadOrder.CostPerLoaf;

            Assert.AreEqual(intendedCostPerLoaf, costPerLoaf);
        }
Пример #11
0
        public void BreadOrder_ProvideInputForNumberOfLoafsToPurchaseInBreadOrder_int()
        {
            int numberOfLoafs         = 2;
            int intendedNumberOfLoafs = 2;

            BreadOrder newBreadOrder = new BreadOrder(numberOfLoafs);

            numberOfLoafs = newBreadOrder.NumberOfLoafs;

            Assert.AreEqual(intendedNumberOfLoafs, numberOfLoafs);
        }
Пример #12
0
        public void TotalCost_AddCostOfPastryOrderToCostOfBreadOrderToCalculateTotalCostOfOrder_int()
        {
            int intendedTotalOrderCost = 15;

            int         numberOfPastries = 3;
            PastryOrder newPastryOrder   = new PastryOrder(numberOfPastries);
            int         pastryOrderCost  = newPastryOrder.OrderCost();

            int        numberOfLoafs  = 2;
            BreadOrder newBreadOrder  = new BreadOrder(numberOfLoafs);
            int        breadOrderCost = newBreadOrder.OrderCost();

            OrderCalculator newOrderCalculator = new OrderCalculator();
            int             totalOrderCost     = newOrderCalculator.TotalCost(breadOrderCost, pastryOrderCost);

            Assert.AreEqual(intendedTotalOrderCost, totalOrderCost);
        }
Пример #13
0
        public static void Main()
        {
            Console.WriteLine("hello and welcome to Pierre's Bakery!");
            Console.WriteLine("Below are some of the food items availible");
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("Bread ------ $5.00 ea or buy 2 or more get one free!");
            Console.WriteLine("Pastry ----- $2.00 ea or 3 for $5.00");
            Console.WriteLine("---------------------------------------------");
            ////////////////////////////////////////////////////////////////////////////
            ////////////////////// ORDERING LOGIC //////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////////

            /////////////////////bread logic //////////////////////////
            Console.WriteLine("how many orders of bread would you like?");
            string     breadResponse = Console.ReadLine();
            int        breadNumber   = int.Parse(breadResponse);
            BreadOrder bread         = new BreadOrder(breadNumber);
            int        cost          = bread.AddBreadPrice(breadNumber);

            Console.WriteLine("would you like to buy some pastries?[y] yes [n] no");
            string answer = Console.ReadLine();

            if (answer.ToLower() == "y")
            {
                Console.WriteLine("how many orders of pastry would you like?");
                string      pastryResponse  = Console.ReadLine();
                int         pastryNumber    = int.Parse(pastryResponse);
                PastryOrder pastry          = new PastryOrder(pastryNumber);
                int         numberResponse2 = pastry.AddPastryPrice(pastryNumber);
                Console.WriteLine("your order total is $" + (pastry.PastryPrice + bread.BreadPrice) + ".00");
                Console.WriteLine("Thank you for coming in today, we hope to see you again soon!");
            }
            else if (answer.ToLower() == "n")
            {
                Console.WriteLine("your order total is $" + (bread.BreadPrice) + ".00");
                Console.WriteLine("Thank you for coming in today, enjoy your bread!");
            }
            else
            {
                Console.WriteLine("something went wrong, retrying order.....");
                Main();
            }
        }
Пример #14
0
        public static void Main()
        {
            Console.WriteLine("Hello! Welcome to Pierres, what would you like to order? loaves are 1 for 5 dollars and buy 2 get 1 free, and pastries and 2 dollars each with a 3 for 5 deal. Enter 'b' for bread and/or 'p' for pastry!");
            String Pob = Console.ReadLine().ToLower();

            if (Pob == "bp" || Pob == "pb")
            {
                Console.WriteLine("How many loaves of bread would you like? Enter a number");
                int Bread = int.Parse(Console.ReadLine());
                Console.WriteLine("How many pastries would you like?");
                int Pastry = int.Parse(Console.ReadLine());
                Console.WriteLine("Thank you, your order total is below!");
                PastryOrder newPastryOrder = new PastryOrder(Pastry);
                int         PastryTotal    = PastryOrder.PriceCalc(newPastryOrder.PastryAmount);
                BreadOrder  newBreadOrder  = new BreadOrder(Bread);
                int         BreadTotal     = BreadOrder.PriceCalc(newBreadOrder.BreadAmount);
                Console.WriteLine(BreadTotal + PastryTotal);
            }
            else if (Pob == "p")
            {
                Console.WriteLine("How many pastries would you like?");
                int Pastry = int.Parse(Console.ReadLine());
                Console.WriteLine("Thank you, your order total is below!");
                PastryOrder newPastryOrder = new PastryOrder(Pastry);
                int         PastryTotal    = PastryOrder.PriceCalc(newPastryOrder.PastryAmount);
                Console.WriteLine(PastryTotal);
            }
            else if (Pob == "b")
            {
                Console.WriteLine("How many loaves of bread would you like? Enter a number");
                int Bread = int.Parse(Console.ReadLine());
                Console.WriteLine("Thank you, your order total is below!");
                BreadOrder newBreadOrder = new BreadOrder(Bread);
                int        BreadTotal    = BreadOrder.PriceCalc(newBreadOrder.BreadAmount);
                Console.WriteLine(BreadTotal);
            }
            else
            {
                Console.WriteLine("We're sorry, something went wrong. Please try again with the response 'p' and/or 'b'. Thank you!");
                Main();
            }
        }
Пример #15
0
        public void OrderCalculator_CalculateCostOfAmountOfLoafsThatAreNotAMultipleOf3_50()
        {
            BreadOrder newBreadOrder = new BreadOrder(14);

            Assert.AreEqual(50, newBreadOrder.OrderCost());
        }
Пример #16
0
        public void BreadOrder_CreateInstanceOfBreadOrder_BreadOrder()
        {
            BreadOrder newBreadOrder = new BreadOrder(2);

            Assert.AreEqual(typeof(BreadOrder), newBreadOrder.GetType());
        }
Пример #17
0
        public void BreadOrder_ProvideInputForNumberOfLoafs_2()
        {
            BreadOrder newBreadOrder = new BreadOrder(2);

            Assert.AreEqual(2, newBreadOrder.NumberOfLoafs);
        }
Пример #18
0
        public void BreadOrder_SetCostPerLoafTo5_5()
        {
            BreadOrder newBreadOrder = new BreadOrder(2);

            Assert.AreEqual(5, newBreadOrder.CostPerLoaf);
        }
Пример #19
0
        public static void Main()
        {
            // Bread Class Call
            List <BreadOrder> Breads = new List <BreadOrder>()
            {
            };
            BreadOrder myBread = new BreadOrder();

            // Bread Class Variables
            int countOneB   = myBread.GetCountOne();
            int countTwoB   = myBread.GetCountTwo();
            int countThreeB = myBread.GetCountThree();

            // Bread Program Sequence
            Console.WriteLine("Here is our Esteemed Bread Selection!: " + myBread.GetBreadOne() + " is " + myBread.GetCostOne() + " Dollars, " + myBread.GetBreadTwo() + " is " + myBread.GetCostTwo() + " Dollars, " + myBread.GetBreadThree() + " is " + myBread.GetCostThree() + " Dollars. If You Buy 2 or More of Any Bread Type, you get 50% off all of them");



startB:
            Console.WriteLine("What Type of Bread Would You Like? To Make it Simple for you Guys, Press 1 for White Bread, Press 2 for French Bread, or Press 3 for Elven Bread, oooo");
            string choice = Console.ReadLine();

            if (choice == "1")
            {
                Console.WriteLine("How Many Slices of " + myBread.GetBreadOne() + " Would You Like");
                countOneB = myBread.SetCountOne(int.Parse(Console.ReadLine()));
            }
            else if (choice == "2")
            {
                Console.WriteLine("How Many Slices of " + myBread.GetBreadTwo() + " Would You Like");
                countTwoB = myBread.SetCountTwo(int.Parse(Console.ReadLine()));
            }
            else if (choice == "3")
            {
                Console.WriteLine("How Many Slices of " + myBread.GetBreadThree() + " Would You Like");
                countThreeB = myBread.SetCountThree(int.Parse(Console.ReadLine()));
            }
            else
            {
                Console.WriteLine("We Dont Have That Bread Thanks for Checking for Errors");
            }

            Console.WriteLine("Do You Want to Order More? Press Y for Yes, and N for No");
            string yes = Console.ReadLine().ToLower();

            if (yes == "y" || yes == "yes")
            {
                goto startB;
            }


            // Adds Bread Ordered to Bread List
            Breads.Add(myBread);

            // Pastry Class Call
            List <PastryOrder> Pastries = new List <PastryOrder>()
            {
            };
            PastryOrder myPastry = new PastryOrder();

            // Pastry Class Variables
            int countOneP   = myPastry.GetCountOne();
            int countTwoP   = myPastry.GetCountTwo();
            int countThreeP = myPastry.GetCountThree();


            // Pastry Program Sequence
            Console.WriteLine("Here is our Exquisite Pastry Selection!: " + myPastry.GetPastryOne() + " are " + myPastry.GetCostOne() + " Dollars, " + myPastry.GetPastryTwo() + " are " + myPastry.GetCostTwo() + " Dollars, " + myPastry.GetPastryThree() + " are " + myPastry.GetCostThree() + " Dollars. If You Buy 2 or More of Any Pastry, you get 50% off all of them");



startP:
            Console.WriteLine("What Type of Pastry Would You Like? To Make it Simple for you Guys, Press 1 for Cherry Danish, Press 2 for Bear Claw, or Press 3 for Jedi Pastries woahhhh.");
            string choiceTwo = Console.ReadLine();

            if (choiceTwo == "1")
            {
                Console.WriteLine("How Many Pieces of " + myPastry.GetPastryOne() + " Would You Like");
                countOneP = myPastry.SetCountOne(int.Parse(Console.ReadLine()));
            }
            else if (choiceTwo == "2")
            {
                Console.WriteLine("How Many Pieces of " + myPastry.GetPastryTwo() + " Would You Like");
                countTwoP = myPastry.SetCountTwo(int.Parse(Console.ReadLine()));
            }
            else if (choiceTwo == "3")
            {
                Console.WriteLine("How Many Pieces of " + myPastry.GetPastryThree() + " Would You Like");
                countThreeP = myPastry.SetCountThree(int.Parse(Console.ReadLine()));
            }
            else
            {
                Console.WriteLine("We Dont Have That Pastry Thanks for Checking for Errors");
            }

            Console.WriteLine("Do You Want to Order More? Press Y for Yes, and N for No");
            string yesTwo = Console.ReadLine().ToLower();

            if (yesTwo == "y" || yesTwo == "yes")
            {
                goto startP;
            }



            Pastries.Add(myPastry);

            int TotalCostBread  = myBread.TotalPrice();
            int TotalCostPastry = myPastry.TotalPrice();

            int FinalCost = TotalCostBread + TotalCostPastry;

            Console.WriteLine("Your Order Total is " + FinalCost + " Dollars. You Spent " + TotalCostBread + " Dollars On Bread and " + TotalCostPastry + " Dollars On Pastries");
        }
Пример #20
0
 public static void Main()
 {
     BreadOrder      newBreadOrder      = new BreadOrder(1);
     PastryOrder     newPastryOrder     = new PastryOrder(1);
     OrderCalculator newOrderCalculator = new OrderCalculator();
 }
Пример #21
0
        public void BreadOrderConstructor_ConstructAnInstanceOfBreadOrder_BreadOrder()
        {
            BreadOrder newBreadOrder = new BreadOrder(1);

            Assert.AreEqual(typeof(BreadOrder), newBreadOrder.GetType());
        }
Пример #22
0
        public void IsOnlyPositiveNumberCharacters_ChecksIfInputIsIntOfNumberChars_False()
        {
            BreadOrder newBreadOrder = new BreadOrder(-1);

            Assert.AreEqual(false, newBreadOrder.IsOnlyPositiveNumberCharacters());
        }
Пример #23
0
        public void GetBreadTotal_ReturnsBreadTotalToUser_10()
        {
            BreadOrder newBreadOrder = new BreadOrder(2);

            Assert.AreEqual(10, newBreadOrder.GetBreadTotal());
        }