Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 . 2 - flights - impl.md 2 0 2 3 - 1 2 - 1 6 1 / 2 Assignment: Implement a Flight Booking

2.2-flights-impl.md 2023-12-16
1/2
Assignment: Implement a Flight Booking System
Objective:
You will develop parts of a simple Flight Booking System based on the Java skeleton created in the
previous assignment. This system will involve persisting data using object serialization, and
implementing search functionality that works against persisted data. It also involves creating and
using a custom exception type.
Tasks:
1. Add flights:
Implement a method to add new flights. Make it possible to enter the arrival and
departure times using a time zone.
2. Search Functionality:
Implement a search method to find flights based on departure and destination. It
should be possible to search for only departures, only destinations and a combination
of departure and destination. Seats and prices don't need to be displayed at this
moment (but feel free to think about how to best present this information).
3. Data Persistence:
Implement object serialization to save and load the state of all Flights. Load all flights
when starting the application and save them all before quitting.
4. Exception Handling:
Handle exceptions that may occur during file operations.
Implement a custom exception called FlightBookingException and throw it whenever a
new flight is added using an already existing flight number. This exception should not
crash the application.
5. User Interface:
Create a simple text-based interface that allows users to interact with the system.
Include options to add flights, passengers, bookings, and to search for flights. (Note that
you only have to implement the functionality for add flights and search for flights).
Create a Main class and use it for all user interaction (input and output). That is, there
should be no print statements but in the Main class.
Example Output:
1. Add Flight
2. Add Passenger
2.2-flights-impl.md 2023-12-16
2/2
3. Book a Flight
4. Search Flights
5. View Bookings
6. Save and Exit
Choose an option: 1
Enter Flight Number: SO123
Enter Departure City: Stockholm
Enter Destination City: Malm
Enter Departure Time (yyyy-MM-dd HH:mm +/-HH:mm): 2023-12-1208:00+02:00
Enter Arrival Time (yyyy-MM-dd HH:mm +/-HH:mm): 2023-12-1210:00+02:00
Flight added successfully.
Choose an option: 4
Enter Departure City (leave blank for any): Stockholm
Enter Destination City (leave blank for any):
Found Flights:
Flight Number: SO123
Departure City: Stockholm
Destination City: Malm
Departure Time: 2023-12-1208:00+02:00
Arrival Time: 2023-12-1210:00+02:00
Flight Number: SO145
Departure City: Stockholm
Destination City: Copenhagen
Departure Time: 2023-12-1209:00+02:00
Arrival Time: 2023-12-1211:30+02:00
Hints:
Use a DateTimeFormatter to help parse the date, time and time zone.
Consider using the class FlightServive to handle the list of all flights (including saving,
loading and searching).

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions