Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the Theater class.
        /// </summary>
        /// <param name="name">The theater's name.</param>
        /// <param name="screeningRoom">The theater's screening room.</param>
        /// <param name="moneyBoxInitialMoneyBalance">The initial money balance of the theater's money collector.</param>
        /// <param name="popcornPrice">The price of a bag of popcorn.</param>
        /// <param name="sodaCupPrice">The price of a cup of soda.</param>
        public Theater(string name, ScreeningRoom screeningRoom, decimal moneyBoxInitialMoneyBalance, decimal popcornPrice, decimal sodaCupPrice)
        {
            this.guests        = new List <Guest>();
            this.movies        = new List <Movie>();
            this.name          = name;
            this.screeningRoom = screeningRoom;

            MoneyCollector moneyBox = new MoneyCollector(moneyBoxInitialMoneyBalance);

            this.popcornStand = new PopcornStand(popcornPrice, moneyBox);
            this.sodaCupStand = new SodaCupStand(sodaCupPrice, moneyBox);
            this.sodaStand    = new SodaStand();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the theater class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="screeningRoom"></param>
        /// <param name="moneyBoxInitialMoneyBalance"></param>
        /// <param name="popcornPrice"></param>
        /// <param name="sodaCupPrice"></param>
        public Theater(SodaStand sodaStand, SodaCupStand sodacupStand, PopcornStand popcornStand, string name, ScreeningRoom screeningRoom, decimal moneyBoxInitialMoneyBalance, decimal popcornPrice, decimal sodaCupPrice)
        {
            this.sodaStand = sodaStand;

            this.sodaCupStand = sodacupStand;

            this.popcornStand = popcornStand;

            this.name = name;

            this.screeningRoom = screeningRoom;

            this.guests = new List <Guest>();

            this.movies = new List <Movie>();
        }
Beispiel #3
0
        /// <summary>
        /// Buys a cup of soda.
        /// </summary>
        /// <param name="sodaCupStand">The stand from which to purchase the cup.</param>
        /// <param name="sodaStand">The stand from which to purchase the soda.</param>
        /// <returns>The cup of soda.</returns>
        private SodaCup BuySoda(SodaCupStand sodaCupStand, SodaStand sodaStand)
        {
            // Define result variable
            SodaCup result = null;

            // Get the price.
            decimal sodaCupPrice = sodaCupStand.ItemPrice;

            decimal sodaCupPayment = this.wallet.RemoveMoney(sodaCupPrice);

            result = sodaCupStand.BuySodaCup(sodaCupPayment);

            this.FillSoda(result, sodaStand);

            // Return result
            return(result);
        }
Beispiel #4
0
        public static Theater NewTheater()
        {
            MoneyCollector moneyBox = new MoneyCollector(450);

            SodaStand sodaStand = new SodaStand();

            SodaCupStand sodaCupStand = new SodaCupStand(4, moneyBox);

            PopcornStand popcornStand = new PopcornStand(5, moneyBox);

            Theater marcusTheater = new Theater(sodaStand, sodaCupStand, popcornStand, "Marcus Theater", new ScreeningRoom(true, 78), 450, 5, 4);

            Wallet wallet = new Wallet("Salmon", 12);

            Guest guest;

            guest = new Guest(26, "The Godfather", "PrDepper", wallet);

            marcusTheater.guests.Add(guest);

            wallet = new Wallet("Brown", 15);

            guest = new Guest(34, "August Rush", "Dolt", wallet);

            marcusTheater.guests.Add(guest);

            Movie movie = new Movie(false, "R", 175, "The God Father");

            marcusTheater.movies.Add(movie);

            movie = new Movie(true, "PG", 95, "Despicable Me");

            marcusTheater.movies.Add(movie);



            return(marcusTheater);
        }
Beispiel #5
0
 /// <summary>
 /// Fills the guest's soda.
 /// </summary>
 /// <param name="sodaCup"></param>
 /// <param name="sodaStand"></param>
 private void FillSoda(SodaCup sodaCup, SodaStand sodaStand)
 {
 }
Beispiel #6
0
 /// <summary>
 /// Sells the guest soda.
 /// </summary>
 /// <param name="sodaCupStand"></param>
 /// <param name="soda"></param>
 /// <returns></returns>
 private SodaCup BuySoda(SodaCupStand sodaCupStand, SodaStand soda)
 {
     return(null);
 }
Beispiel #7
0
 /// <summary>
 /// Fills a soda cup.
 /// </summary>
 /// <param name="sodaCup">The cup to fill.</param>
 /// <param name="sodaStand">The stand from which to fill the cup.</param>
 private void FillSoda(SodaCup sodaCup, SodaStand sodaStand)
 {
     // Fill the soda cup
     sodaStand.FillSodaCup(sodaCup, this.preferredSodaFlavor);
 }
Beispiel #8
0
        /// <summary>
        /// Buys concessions.
        /// </summary>
        /// <param name="popcornStand">The stand from which to purchase popcorn.</param>
        /// <param name="sodaCupStand">The stand from which to purchase a soda cup.</param>
        /// <param name="sodaStand">The stand from which to fill a soda cup.</param>
        public void BuyConcessions(PopcornStand popcornStand, SodaCupStand sodaCupStand, SodaStand sodaStand)
        {
            // Buy popcorn
            Popcorn popcorn = this.BuyPopcorn(popcornStand);

            popcorn.AddButter();
            popcorn.AddSalt();
            popcorn.AddSalt();
            this.concessionItems.Add(popcorn);

            // Buy soda
            SodaCup sodaCup = this.BuySoda(sodaCupStand, sodaStand);

            this.concessionItems.Add(sodaCup);

            foreach (ConcessionItem ci in this.concessionItems)
            {
                ci.Consume();
            }
        }