示例#1
0
        /// <summary>
        /// Gives the guest a free coupon book.
        /// </summary>
        /// <returns>Returns a map.</returns>
        public Map GiveFreeMap()
        {
            Item item = null;

            try
            {
                item = Attendant.FindItem(this.Items, typeof(Map));
            }
            catch (Exception)
            {
                throw new MissingItemException("Map not found.");
            }

            return(item as Map);
        }
示例#2
0
        /// <summary>
        /// Gives the guest a free coupon book.
        /// </summary>
        /// <returns>Returns a coupon book.</returns>
        public CouponBook GiveFreeCouponBook()
        {
            Item item = null;

            try
            {
                item = Attendant.FindItem(this.Items, typeof(CouponBook));
            }
            catch (Exception)
            {
                throw new MissingItemException("Couponbook not found.");
            }

            return(item as CouponBook);
        }
示例#3
0
        /// <summary>
        /// Sells the guest a water bottle.
        /// </summary>
        /// <param name="payment">The payment for the water bottle.</param>
        /// <returns>Returns a water bottle.</returns>
        public WaterBottle SellWaterBottle(decimal payment)
        {
            Item item = null;

            try
            {
                if (payment == this.WaterBottlePrice)
                {
                    item = Attendant.FindItem(this.Items, typeof(WaterBottle));

                    if (item != null)
                    {
                        this.AddMoney(payment);
                    }
                }
            }
            catch (Exception)
            {
                throw new MissingItemException("Waterbottle not found.");
            }

            return(item as WaterBottle);
        }