Exemple #1
0
        /// <summary>
        /// Visits the ticket booth.
        /// </summary>
        /// <param name="ticketBooth"> The ticket booth that will be visited.</param>
        /// <returns> The ticket from the ticket booth.</returns>
        public Ticket VisitTicketBooth(Booth ticketBooth)
        {
            // Gets the ticket price and stores it in the amount.
            decimal amount = ticketBooth.TicketPrice;

            // Calls the wallet's remove money.
            decimal removedMoney = this.wallet.RemoveMoney(amount);

            // Sells the ticket.
            Ticket ticket = ticketBooth.SellTicket(removedMoney);

            // Get the water price.
            decimal waterPrice = ticketBooth.WaterBottlePrice;

            // Remove money from the wallet.
            decimal money = this.wallet.RemoveMoney(waterPrice);

            // Sells the water.
            WaterBottle waterBottle = ticketBooth.SellWaterBottle(waterPrice);

            // Gets the map.
            Map map = ticketBooth.GiveFreeMap();

            // Gets  the coupon book.
            CouponBook couponBook = ticketBooth.GiveFreeCouponBook();

            return(ticket);
        }
Exemple #2
0
        /// <summary>
        /// Gives a coupon book away for free.
        /// </summary>
        /// <returns> The coupon book that is being given away.</returns>
        public CouponBook GiveFreeCouponBook()
        {
            CouponBook couponBook = null;

            // Find the coupon book.
            couponBook = this.Attendant.FindItem(this.Items, typeof(CouponBook)) as CouponBook;

            return(couponBook);
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the Booth class.
        /// </summary>
        /// <param name="attendant">The employee to be the booth's attendant.</param>
        /// <param name="ticketPrice">The price of a ticket.</param>
        /// <param name="waterBottlePrice"> The price of the water bottle.</param>
        public Booth(Employee attendant, decimal ticketPrice, decimal waterBottlePrice)
        {
            this.attendant   = attendant;
            this.ticketPrice = ticketPrice;
            //// DateTime today = new DateTime(2018, 6, 9);

            // Creates a list of coupon books.
            this.couponBooks = new List <CouponBook>();

            // Make 5 coupon books and stop at 5.
            for (int c = 0; c < 5; c++)
            {
                // Create a variable of type coupon book and pass in the correct parameters.
                CouponBook couponBook = new CouponBook(DateTime.Now, DateTime.Now.AddYears(1), 0.8);

                // Add the coupon book to the list of coupon books.
                this.couponBooks.Add(couponBook);
            }

            // Creates a new list of maps.
            this.maps = new List <Map>();

            // Make 10 maps.
            for (int m = 0; m < 10; m++)
            {
                // Create a variable of type map and pass in the correct parameters.
                Map map = new Map(.5, DateTime.Now);

                this.maps.Add(map);
            }

            // Creates a new list of tickets.
            this.tickets = new List <Ticket>();

            // Creates 5 tickets.
            for (int t = 0; t < 5; t++)
            {
                // Create a variable of type ticket and pass in the correct parameters.
                Ticket ticket = new Ticket(15, t + 1, .01);

                this.tickets.Add(ticket);
            }

            // Creates a list of water bottles.
            this.waterBottles = new List <WaterBottle>();

            // Creates 5 water bottles.
            for (int w = 0; w < 5; w++)
            {
                // Creates a new water bottle and pass in the correct parameters.
                WaterBottle waterBottle = new WaterBottle(3, w + 1, 1);

                this.waterBottles.Add(waterBottle);

                this.waterBottlePrice = waterBottle.Price;
            }
        }
Exemple #4
0
        /// <summary>
        /// Gives a coupon book away for free.
        /// </summary>
        /// <returns> The coupon book that is being given away.</returns>
        public CouponBook GiveFreeCouponBook()
        {
            CouponBook couponBook = null;

            // Find the coupon book.
            couponBook = attendant.FindCouponBook(couponBooks);

            return(null);
        }
Exemple #5
0
        /// <summary>
        /// Visits the information booth.
        /// </summary>
        /// <param name="informationBooth"> The booth being visited.</param>
        public void VisitInformationBooth(GivingBooth informationBooth)
        {
            // Gets the map.
            Map map = informationBooth.GiveFreeMap();

            // Gets  the coupon book.
            CouponBook couponBook = informationBooth.GiveFreeCouponBook();

            bag.Add(map);
            bag.Add(couponBook);
        }
Exemple #6
0
        /// <summary>
        /// The guest visits the information booth.
        /// </summary>
        /// <param name="informationBooth">The information booth to visit.</param>
        public void VisitInformationBooth(GivingBooth informationBooth)
        {
            // Get a free map and add it to the bag..
            Map map = informationBooth.GiveFreeMap();

            this.bag.Add(map);

            // Get a free coupon book and add it to the bag.
            CouponBook couponBook = informationBooth.GiveFreeCouponBook();

            this.bag.Add(couponBook);
        }
Exemple #7
0
        /// <summary>
        /// Visits the information booth to obtain a coupon book and a map.
        /// </summary>
        /// <param name="informationBooth">The booth to visit.</param>
        public void VisitInformationBooth(GivingBooth informationBooth)
        {
            // Get map.
            Map map = informationBooth.GiveFreeMap();

            // Get coupon book.
            CouponBook couponBook = informationBooth.GiveFreeCouponBook();

            // Add items to bag.
            this.bag.Add(map);
            this.bag.Add(couponBook);
        }
        /// <summary>
        /// Gives away a free coupon book.
        /// </summary>
        /// <returns>The given coupon book.</returns>
        public CouponBook GiveFreeCouponBook()
        {
            CouponBook result = null;

            try
            {
                result = this.Attendant.FindItem(this.Items, typeof(CouponBook)) as CouponBook;
            }
            catch (MissingItemException ex)
            {
                throw new NullReferenceException("Coupon book not found.", ex);
            }

            return(result);
        }
Exemple #9
0
        /// <summary>
        /// Finds the coupon book.
        /// </summary>
        /// <param name="couponStack"> The coupon stack.</param>
        /// <returns> The coupon book that gets found.</returns>
        public CouponBook FindCouponBook(List <CouponBook> couponStack)
        {
            CouponBook couponBook = null;

            // If there are more than one coupon books left.
            if (couponStack.Count > 0)
            {
                // Take a coupon book away.
                couponBook = couponStack[0];

                // Remove the coupon book from the list.
                couponStack.Remove(couponBook);
            }

            return(couponBook);
        }
Exemple #10
0
        /// <summary>
        /// Gives a coupon book away for free.
        /// </summary>
        /// <returns> The coupon book that is being given away.</returns>
        public CouponBook GiveFreeCouponBook()
        {
            CouponBook couponBook = null;

            // Try and find the coupon book.
            try
            {
                // Find the coupon book.
                couponBook = this.Attendant.FindItem(this.Items, typeof(CouponBook)) as CouponBook;
            }
            // Throw a new exception.
            catch (Exception)
            {
                throw new MissingItemException("Cannot find the coupon book.");
            }

            return(couponBook);
        }
Exemple #11
0
        /// <summary>
        /// Initializes a new instance of the GivingBooth class.
        /// </summary>
        /// <param name="attendant">The booth's attendant.</param>
        public GivingBooth(Employee attendant)
            : base(attendant)
        {
            // Create time variables.
            DateTime dateMade    = DateTime.Now;
            DateTime dateExpired = DateTime.Now.AddYears(1);

            for (int i = 0; i < 5; i++)
            {
                CouponBook couponBook = new CouponBook(dateMade, dateExpired, 0.8);
                this.Items.Add(couponBook);
            }

            // Create maps and add them to the list.
            for (int i = 0; i < 10; i++)
            {
                Map map = new Map(0.5, dateMade);
                this.Items.Add(map);
            }
        }
Exemple #12
0
        /// <summary>
        /// Initializes a new instance of the GivingBooth class.
        /// </summary>
        /// <param name="attendant"> The employee who will work the booth.</param>
        public GivingBooth(Employee attendant)
            : base(attendant)
        {
            // Make 5 coupon books and stop at 5.
            for (int c = 0; c < 5; c++)
            {
                // Create a variable of type coupon book and pass in the correct parameters.
                CouponBook couponBook = new CouponBook(DateTime.Now, DateTime.Now.AddYears(1), 0.8);

                this.Items.Add(couponBook);
            }

            // Make 10 maps.
            for (int m = 0; m < 10; m++)
            {
                // Create a variable of type map and pass in the correct parameters.
                Map map = new Map(.5, DateTime.Now);

                this.Items.Add(map);
            }
        }
        /// <summary>
        /// Visits a booth to acquire information.
        /// </summary>
        /// <param name="informationBooth">The booth to visit.</param>
        public void VisitInformationBooth(GivingBooth informationBooth)
        {
            Map map = informationBooth.GiveFreeMap();

            CouponBook couponBook = informationBooth.GiveFreeCouponBook();
        }