//SECTION: 02
//GROUP: TOP GUN

//FERRY TICKETING MANAGEMENT SYSTEM

//CLASS FEE
interface Fee
{
 double tax_Rate = 0.07;
 double calculatePrice();
}

//TICKET class abstraction
abstract class Ticket
{
	public double Price;
	public String Name;
	public String SeatNum, CompanyName, Category;
	public int PhoneNum;
        
        //Default constructor
	public Ticket(){}

        //Constructor with argument
	public Ticket(double p, String n, String cn, String s, String c,int pnum)
	{
		Price = p;
		Name = n;
		CompanyName = cn;
		SeatNum = s;
		Category = c;
		PhoneNum = pnum;
	}

	//Getter function/Accessors
        public double getPrice(){
		return Price;
	}

	public abstract void displayTicketforPassenger();
	public abstract void displayTicketforFerry();
}


//Kids class subclass of Ticket implement Fee class
class Kids extends Ticket implements Fee
{
	 private double totalPrice;
	 private double Kids_discount_Rate;

	 //Default constructor
         public Kids(){}

	 //Constructor with argument
         public Kids(double r, double p, String n, String cn, String s, String c, int pnum)
	 {
		 super(p,n,cn,s,c,pnum);
		 Kids_discount_Rate = r;
	 }

	 public double calculatePrice()
	 {
		 double calc1, calc2;
		 calc1 = super.Price * Kids_discount_Rate;
		 calc2 = super.Price * tax_Rate;
		 totalPrice = super.Price - calc1 + calc2;
		 return totalPrice;
	 }

	 public void displayTicketforPassenger()
	 {
		 System.out.println(super.Name + "\t\t" + super.PhoneNum + "\t" + super.CompanyName + "\t\t"
		 +  super.SeatNum + "\t" + super.Price + "\t" + calculatePrice());

	 }

	 public void displayTicketforFerry()
	 {
	 	 System.out.println(super.Name + "\t\tKids\t\t" + super.PhoneNum + "\t"
	 	 +  super.SeatNum + "\t\t" + super.Price + "\t" + calculatePrice());

	 }
 }

//Adults class subclass of Ticket implement Fee class
 class Adults extends Ticket implements Fee
 {
	 private double totalPrice;
	 private double InsuranceTaxRate;

	 //Default constructor
         public Adults(){}

	 //Constructor with argument
         public Adults(double r, double p, String n, String cn, String s, String c, int pnum)
	 {
		 super(p,n,cn,s,c,pnum);
		 InsuranceTaxRate = r;

	 }

	 public double calculatePrice()
	 {
		 double calc1, calc2;
		 calc1 = super.Price * InsuranceTaxRate;
		 calc2 = super.Price * tax_Rate;
		 totalPrice = super.Price + calc1 + calc2;
		 return totalPrice;
	 }

	 public void displayTicketforPassenger()
	 {
		 System.out.println(super.Name + "\t\t" + super.PhoneNum + "\t" + super.CompanyName + "\t\t"
		 +  super.SeatNum + "\t" + super.Price + "\t" + calculatePrice());
	 }

	 public void displayTicketforFerry()
	 	 {
                         
                     System.out.println(super.Name + "\t\tAdults\t\t" + super.PhoneNum + "\t" +  super.SeatNum + "\t\t" +
                             super.Price + "\t" + calculatePrice());   

	 }
 }
