示例#1
0
        //Calculate Dessert Booth cost
        public Dessert DessertCost()
        {
            List <Dessert> dessertList = new List <Dessert>();
            Dessert        dessert     = new Dessert();

            foreach (Barbecue b in _barbecueList)
            {
                dessertList.Add(b.NewDessert);
            }
            foreach (Dessert d in dessertList)
            {
                dessert.IceCreamCost += (d.IceCreamCost * d.TotalIceCreamGiven);
            }
            foreach (Dessert d in dessertList)
            {
                dessert.PopcornCost += (d.PopcornCost * d.TotalPopcornGiven);
            }
            foreach (Dessert d in dessertList)
            {
                dessert.CondimentCost += d.CondimentCost;
            }
            foreach (Dessert d in dessertList)
            {
                dessert.TicketsCollected += d.TicketsCollected;
            }
            return(dessert);
        }
示例#2
0
        //Create new booth\
        public void CreateNewBooth(Dessert d, Burger b)
        {
            Barbecue barbecue = new Barbecue();

            barbecue.NewBurger  = b;
            barbecue.NewDessert = d;
            _barbecueList.Add(barbecue);
        }
        //Create
        private void CreateBarbecue()
        {
            // Burger booth
            Burger  burger  = new Burger();
            Dessert dessert = new Dessert();

            Console.WriteLine("How many Burger's were given out?");
            burger.HamburgerGiven = int.Parse(Console.ReadLine());
            Console.WriteLine("How much did each burger cost?");
            burger.HamburgerCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How many Hot Dog's were given out?");
            burger.HotDogGiven = int.Parse(Console.ReadLine());
            Console.WriteLine("How much did each hot dog cost?");
            burger.HotDogCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How many Veggie burgers were given out?");
            burger.VeggieBurgerGiven = int.Parse(Console.ReadLine());
            Console.WriteLine("How much did each Veggie burger cost?");
            burger.VeggieBurgerCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How much was spent on condiments for this booth (napkins, ketchup, etc)?");
            burger.CondimentCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How many tickets were collected at the burger booth?");
            burger.TicketsCollected = int.Parse(Console.ReadLine());
            Console.Clear();

            // Ice Cream Booth
            Console.WriteLine("Now let's talk about the Dessert booth.\n" +
                              "How many gallons of Ice Cream were consumed?");
            dessert.TotalIceCreamGiven = int.Parse(Console.ReadLine());
            Console.WriteLine("How much did each gallon of ice cream cost?");
            dessert.IceCreamCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How many bags of popcorn were given out?");
            dessert.TotalPopcornGiven = int.Parse(Console.ReadLine());
            Console.WriteLine("How much did each bag of popcorn cost?");
            dessert.PopcornCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How much did this booth spend on condiments?");
            dessert.CondimentCost = decimal.Parse(Console.ReadLine());
            Console.WriteLine("How many tickets did the dessert booth collect?");
            dessert.TicketsCollected = int.Parse(Console.ReadLine());
            _bbqRepo.CreateNewBooth(dessert, burger);
        }