Question: class booking { private String pack; private int departDate; private int returnDate; private int numOfPax; private String type; private double price; public booking () {
class booking
{
private String pack;
private int departDate;
private int returnDate;
private int numOfPax;
private String type;
private double price;
public booking ()
{
}
public booking (String pa, String t, int dd, int rd, int nop, double p)
{
pack = pa;
type = t;
departDate = dd;
returnDate = rd;
numOfPax = nop;
price = p;
}
public void setData (String pa, String t, int dd, int rd, int nop, double p)
{
pack = pa;
type = t;
departDate = dd;
returnDate = rd;
numOfPax = nop;
price = p;
}
public String getPack()
{
return pack;
}
public String getType()
{
return type;
}
public int getDepartDate()
{
return departDate;
}
public int getReturnDate()
{
return returnDate;
}
public int getNumOfPax()
{
return numOfPax;
}
public double getPrice()
{
return price;
}
public double totalPayment ()
{
double newPrice;
double govTax;
double serviceTax;
double totalPrice;
double transPrice;
if (type.equalsIgnoreCase("Silver"))
{
price = 1500;
System.out.println("Transport colour is White");
}
else if (type.equalsIgnoreCase("Gold"))
{
price = 2000;
System.out.println("Transport colour is Blue");
}
else if (type.equalsIgnoreCase("Platinum"))
{
price = 3000;
System.out.println("Transport colour is Red");
}
govTax = 0.03;
serviceTax = 0.10;
transPrice = 200;
totalPrice = price + transPrice;
newPrice = totalPrice + (totalPrice * 0.03) + (totalPrice * 0.10);
return newPrice;
}
public String toString()
{
return " DepartDate: "+departDate+" ReturnDate: "+returnDate+" Num Of Pax: "+numOfPax+" Total Payment: "+totalPayment();
}
}
==============================================================================================================================================
class customer
{
private int userID;
private String name, email;
private booking b;
public customer()
{
this.b = new booking();
this.userID = 0;
this.name = " ";
this.email = " ";
}
public customer ( int id, String n, String e,String pa, int dd, int rd, int nop)
{
this.b = new booking ();
this.userID = userID;
this.name = name;
this.email = email;
}
public int getUserID()
{
return userID;
}
public String getName()
{
return name;
}
public String getEmail()
{
return email;
}
public String getPack()
{
String pack;
pack = b.getPack();
return pack;
}
public int getDepartDate()
{
int departDate;
departDate = b.getDepartDate();
return departDate;
}
public int getReturnDate()
{
int returnDate;
returnDate = b.getReturnDate();
return returnDate;
}
public int getNumOfPax()
{
int numOfPax;
numOfPax = b.getNumOfPax();
return numOfPax;
}
public String toString()
{
return "User ID: "+userID+" Name: "+name+" Email: "+email+" Package: "+b.getPack()+" Depart Date: "+b.getDepartDate()+" Return Date: "+b.getReturnDate()+" Num Of Pax: "+b.getNumOfPax();
}
}
==============================================================================================================================================
From two class above you should create the main class for run this program completely. Please write complete main class for both class above.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
