Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 . 2 - flights - impl.md 2 0 2 3 - 1 2 - 1 6 1 / 2 Assignment: Implement a Flight Booking
flightsimpl.md
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:
Add flights:
Implement a method to add new flights. Make it possible to enter the arrival and
departure times using a time zone.
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
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.
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.
User Interface:
Create a simple textbased 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:
Add Flight
Add Passenger
flightsimpl.md
Book a Flight
Search Flights
View Bookings
Save and Exit
Choose an option:
Enter Flight Number: SO
Enter Departure City: Stockholm
Enter Destination City: Malm
Enter Departure Time yyyyMMdd HH:mm HH:mm: ::
Enter Arrival Time yyyyMMdd HH:mm HH:mm: ::
Flight added successfully.
Choose an option:
Enter Departure City leave blank for any: Stockholm
Enter Destination City leave blank for any:
Found Flights:
Flight Number: SO
Departure City: Stockholm
Destination City: Malm
Departure Time: ::
Arrival Time: ::
Flight Number: SO
Departure City: Stockholm
Destination City: Copenhagen
Departure Time: ::
Arrival Time: ::
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started