Overview:

OzCharter is an Australian airline that offers charter flights to various places within Australia. They operate between the capital cities, but also to small rural airports. They are building a website to enable online flight bookings and they have chosen you to write it. The first version will have the ability to create passengers and book passengers on a flight, search for a flight, view all flights and pay for a flight.

Below are the requirements of the software:

Getting Started:

  • Create a new project in BlueJ called Assignment1. All classes for the assignment are to be saved in this project.
  • Create the required classes for the project - there should be at least three (3) classes: OzCharter, Flight and Passenger. You can have any number of additional classes you think are required.
  • Class basics:
    OzCharter – this class has a maximum of 3 flights, a company name, a company URL (web address), and a counter for the number of flights that currently exist

    Flight – a flight has a maximum of 4 passengers, a flight number (1 to 3), an origin, a destination, a seat price, departure time and arrival time (as int), a counter for the number of passengers currently booked on the flight

    Passenger – a passenger has an id, name, email, gender, amount of money to spend (or credit), an is adult status (true or false) a booked status (true if booked on a flight) and a paid status (true if the flight has been paid for)
  • Constructors: all classes must have at least 1 constructor. The alternate constructor must initialise the class attributes (done in the body of the constructor).
  • StartUp: when the program first starts, there should be 3 flights created in OzCharter, so that passengers can view and select these.

Functionality:

The user of OzCharter must be able to:

  • Add a passenger
  • Search for a flight
  • Search for a passenger
  • View a list of all flights
  • Book a passenger onto a flight
  • Pay for a flight
  • View a list of passengers on a flight

Detailed Functionality:

  • Add a passenger Passengers are added to the system before they can book a flight. The program must be able to add passengers to OzCharter, up to a maximum of 6 passengers. The passenger ID’s are 1 up to 6, passenger 1 is added first, then passenger 2 etc.
  • Display all flights When a user selects to view all flights, display a list of all flights that currently exist (maximum of 3). Details should include flight number, origin and destination airport, number of passengers currently booked on the flight, departure and arrival time, and the seat price.
  • Search for a flight A user can search for a flight by flight number, origin airport or destination airport. If any flight matches the criteria entered, display all details of the flight. If no matching flight was found, display an error message.
  • Search for a passenger A user can search for a passenger by ID or email address. If any passenger matches the criteria entered, display all details of the passenger. If no matching passenger was found, display an error message.
  • Book a flight A user can book a passenger on a flight. The passenger must already be created in the system and their booking status must be false (not already booked on a flight). If they are not in the system, or already booked on a flight, then an error is displayed. The user must enter the flight number. If the flight number exists and the flight is not full, the passenger is added to the flight. The booked status of the passenger is set to true (passengers can only be booked onto 1 flight) and the paid status of the passenger is set to false. The total number of passengers booked on the flight is also incremented.
  • Pay for a flight A user can pay for a flight. When payment is processed successfully the price of the flight is deducted from the amount of money a passenger has, and the paid status of the passenger is set to true. If the passenger does not have enough money, the paid status remains as false and an error message is displayed.
  • View a list of passengers on a flight When a user selects to view all passengers on a flight, display a list of all passengers booked on the flight (maximum is 4). Details should include passenger ID, name, email and gender.

Program Flow:

Add a new class called MyCharterProgram to the project that has a main method so that:

  • OzCharter object is created
  • details about the company are then displayed (name and website)

The main method will then be used to simulate the daily usage of the application. All functionality listed above must be demonstrated – an example simulation could be:

  • Create 3 flights in OzCharter
  • Display a list of all available flights (should see 3 flights)
  • Search for a flight (not found)
  • Search for a flight (found)
  • Create a passenger
  • Book a passenger onto a flight (passenger found)
  • Book a passenger onto a flight (passenger NOT found)
  • Search for a passenger
  • Pay for a flight
  • View a list of all passengers booked on a flight
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.