Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your Task You will be implementing a Flight Reservation system. Passengers able

ID: 3578115 • Letter: Y

Question

Your Task You will be implementing a Flight Reservation system. Passengers able to make and cancel flight reservations, and be able to upgrade from coach to first class seats. be Your solution will feature the Takeom driver class, Passenger, and Aircraft interface data classes, the Flight database class, which implements the Passel ngerBooking. Here's how it works: The driver class calls the test() method where the primary objects are created. Passengers are added to and removed from a flight. The flight will hold no more than 10 passengers. Ensure this number cannot be exceeded A maximum of four first class passengers can board the plane. First class passengers pay twice (2xs) the fair cost of coach passengers. Coach class passengers will occupy the remaining 6 seats. You are to use the TakeOff driver class to create and add passengers to the flight/plane, as well as remove passengers from the flight. The driver MUST also perform negative tests to ensure the flight is not over-filled beyond 10 passengers, and only four first class passengers are allowed on the flight. The output should display the flight number and the type of aircraft. Also, the output should display the first class passengers by name and seat number. The same will be done for the coach passengers. It should be clearly indicated whether passengers are first class or coach class. Finally the total ticket costs paid by all passengers on the flight should be displayed.

Explanation / Answer

public class Aircraft
{
String ype;
String getType()
{
return a;
}
void setType(String a)
{
this.a=a;
}
}

class Passenger
{
String firstName;
String lastName;
String creditCard;
String email;


Passenger(String f,String l,String c,String e);
{
firstName=f;
lastname=l;
creditCard=c;
email=e;
}
void display()
{
System.out.println(firstName+" "+lastName+" "+creditcard+"

"+email);
}
public booleanstatus(){
if (class="firstclass")
{
return true;
}
else
{
return false;
}
  
}
class Flight
{
String flightNUmber;
double amount;
Flight(string n,double d)
{
flightName=n;
amount=d;
}
void display()
{
System.out.println(flightName+" "+amount)
}

}
interface Reserve
{
void reserve();
}
  
interface Cancel {
void cancel();
}
class PassengerBooking implements Reserve,Cancel{
  
public void print(){System.out.println("reserved");}
public void show(){System.out.println("canclled");}
}
class Test
{
public static void main(String args[])
{   
aircraft a=new aircraft();


Passenger p1=new passenger("rahul", "kumar", "yes",

"rahulkumar.com");
Passenger p2=new passenger("ravi", "raj", "yes", "raviraj.com");
p1.display();
p2.display();
pi.booleanstatus():

Flight f1=new Flight("indigo",2000);
Flight f1=new Flight("kingfisher",3000);

f1.display();
f2.display();

PassengerBooking b=new PassengerBooking();
b.reserve();
b.cancel();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote