//FOR TESTING public void SellTicket(string _name, DateTime _buyingTime) { EconomyTicket t = new EconomyTicket(); t.name = _name; SetFlightDate(); t.date = flightDate; ApplyWeekdayRate(basePrice); ApplyTimeRateForTestingOnly(finalPrice, _buyingTime); ApplyOccupancyRate(finalPrice); t.ticketPrice = finalPrice; GetFirstCity(); GetSecondCity(); SetDirection(); t.fromCity = from; t.toCity = to; t.seatNr = ticketCounter; emptySeats = nrOfSeats - SoldEconomyTickets.Count; if (emptySeats == 0) { Console.WriteLine("Plane is full!"); } else { SoldEconomyTickets.Add(t); ticketCounter++; t.PrintTicketInfo(); } }
internal virtual EconomyTicket CreateTicket(string _name) { EconomyTicket t = new EconomyTicket(); t.name = _name; SetFlightDate(); t.date = flightDate; ApplyWeekdayRate(basePrice); ApplyTimeRate(finalPrice); ApplyOccupancyRate(finalPrice); t.ticketPrice = finalPrice; GetFirstCity(); GetSecondCity(); SetDirection(); t.fromCity = from; t.toCity = to; t.seatNr = ticketCounter; SoldEconomyTickets.Add(t); ticketCounter++; t.PrintTicketInfo(); return(t); }