public override ITicket BuyTicket(APerson person) { ITicket adultTicket = new AdultTicket(); Ticket = adultTicket; return(Ticket); }
/// <summary> /// Adds the tickets specified to the tickets List, if the number of tickets exceeds the booking.LIMIT value then an exception is thrown. /// </summary> /// <param name="fee">The booking fee.</param> /// <param name="number">The number of tickets to be booked.</param> /// <param name="type">The type of ticket to be added.</param> public void AddTickets(int number, TicketType type, decimal fee) { if (tickets.Count < Booking.LIMIT) { if (type == TicketType.Adult) { for (int i = 0; i < number; i++) { AdultTicket newTicket = new AdultTicket(show.Title, fee); tickets.Add(newTicket); } } else if (type == TicketType.Child) { for (int i = 0; i < number; i++) { ChildTicket newTicket = new ChildTicket(show.Title); tickets.Add(newTicket); } } else if (type == TicketType.Family) { for (int i = 0; i < number; i++) { FamilyTicket newTicket = new FamilyTicket(show.Title, fee); tickets.Add(newTicket); } } } else { throw new BookingException(this.BookingID); } }