Question: You defined Hotel class and Flight class correctly in their same named source file, but redefined them as inner class of the Reservation again. And

You defined Hotel class and Flight class correctly in their same named source file, but redefined them as inner class of the Reservation again. And you inner class Reservation in the Reservation class.
public class Reservation {
private String customerName;
private Flight flight;
private Hotel room;
// Non-argument constructor
public Reservation(){}
public class Flight {
private String airlines;
private int flightNumber;
private double flightFare;
// Non-argument constructor
public Flight(){}
// Full constructor
public Flight(String airlines, int flightNumber, double flightFare){
this.airlines = airlines;
this.flightNumber = flightNumber;
this.flightFare = flightFare;
}
// Set and get methods for airlines
public void setAirlines(String airlines){
this.airlines = airlines;
}
public String getAirlines(){
return airlines;
}
// Set and get methods for flightNumber
public void setFlightNumber(int flightNumber){
this.flightNumber = flightNumber;
}
public int getFlightNumber(){
return flightNumber;
}
// Set and get methods for flightFare
public void setFlightFare(double flightFare){
this.flightFare = flightFare;
}
public double getFlightFare(){
return flightFare;
}
@Override
public String toString(){
return "Airlines: "+ airlines +", Flight Number: "+ flightNumber +", Flight Fare: $"+ flightFare;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!