Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago