public virtual void GenerateTicket (float P, String Source, String Destination)
if ((Source == null) || (Destination == null))
Console.WriteLine("Please choose a Source and Destination ");
throw new ArgumentOutOfRangeException("", "No Source and Destination ");
price = price - P * 0.1f;
Console.WriteLine("THE TICKETS WILL COST : " + price + "$");
Console.WriteLine("ATLEAST ONE PASSENGER REQ");
public class UltraLuxuryBooking: Booking {
public override void GenerateTicket(float P, String Source, String Destination) {
if ((Source == null) || (Destination == null))
Console.WriteLine("Please Fill out a source and destination ");
throw new ArgumentOutOfRangeException("", "Source or Destination cannot be null ");
price = price - P * 0.1f;
Console.WriteLine("THE TICKETS WILL COST : " + price + "$");
Console.WriteLine("ATLEAST TWO PASSENGERS REQ");
public class Family_Holiday_Booking: Booking {
public override void GenerateTicket(float P, String Source, String Destination) {
if ((Source == null) || (Destination == null))
Console.WriteLine("Source/Destination cannot be null");
throw new ArgumentOutOfRangeException ("", "Source or Destination cannot be null ");
Console.WriteLine("THE TICKETS WILL COST : " + price + "$");
Console.WriteLine("Atleast 2 People Required");
Console.WriteLine("ENTER YOUR NAME:");
name = Console.ReadLine();
Console.WriteLine("ENTER NUMBER OF PASSENGERS:");
passengers = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("1) Luxury ");
Console.WriteLine("2) Ultra Luxury");
Console.WriteLine("3) Family Holiday");
choice = Convert.ToInt32(Console.ReadLine());
Booking book_obj = new Booking();
book_obj.GenerateTicket(passengers, "Delhi", "Bangalore");
book_obj = new UltraLuxuryBooking();
book_obj.GenerateTicket(passengers, "Kolkata", "Delhi");
book_obj = new Family_Holiday_Booking();
book_obj.GenerateTicket(passengers, "Mumbai", "Faridabad");
} catch (ArgumentOutOfRangeException outOfRange) {
Console.WriteLine("Error: {0}", outOfRange.Message);