Package bcu.cmp5332.bookingsystem.model
Class FlightBookingSystem
java.lang.Object
bcu.cmp5332.bookingsystem.model.FlightBookingSystem
Represents the flight booking system.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBooking(Booking booking) Adds a booking to the system.voidaddCustomer(Customer customer) Adds a customer to the system.voidaddFeedback(int bookingID, int customerID, String message) Adds feedback for a specific booking.voidaddFeedback(Feedback feedback) voidAdds a flight to the system.voidcancelBooking(int customerId, int flightId) Cancels a booking for a given customer and flight.getBookingByID(int bookingID) Retrieves a booking by its ID.Booking[]Retrieves an array of all bookings in the system.Retrieves a list of all customers in the system.getCustomerByID(int id) Retrieves a customer by their ID.getCustomerByName(String customerName) Retrieves a customer by their name.Customer[]Retrieves an array of all customers in the system.Retrieves all feedback provided by customers.getFlightByID(int delId) Retrieves a flight by its ID.Retrieves a list of all future flights in the system.getFutureFlights(LocalDate systemDate) Retrieves a list of all future flights in the system that have not departed.Retrieves the current date of the system.voidissueBooking(Customer customer, Flight flight, LocalDate bookingDate) Issues a booking for a customer on a flight with the specified booking date.voidremoveFlight(Flight flightToDelete) Removes a flight from the system.
-
Constructor Details
-
FlightBookingSystem
public FlightBookingSystem()
-
-
Method Details
-
getSystemDate
Retrieves the current date of the system.- Returns:
- The current date of the system
-
addBooking
Adds a booking to the system.- Parameters:
booking- The booking to be added to the system
-
getFutureFlights
Retrieves a list of all future flights in the system that have not departed.- Parameters:
systemDate- The current date of the system- Returns:
- A list of all future flights in the system that have not departed
-
getCustomer
Retrieves a list of all customers in the system.- Returns:
- A list of all customers in the system
-
getFlightByID
Retrieves a flight by its ID.- Parameters:
delId- The ID of the flight to retrieve- Returns:
- The flight with the specified ID
- Throws:
FlightBookingSystemException- If no flight exists with the given ID
-
getCustomerByID
Retrieves a customer by their ID.- Parameters:
id- The ID of the customer to retrieve- Returns:
- The customer with the specified ID
- Throws:
FlightBookingSystemException- If no customer exists with the given ID
-
addFlight
Adds a flight to the system.- Parameters:
flight- The flight to be added to the system- Throws:
FlightBookingSystemException- If a flight with the same ID or same number and departure date already exists in the system
-
addCustomer
Adds a customer to the system.- Parameters:
customer- The customer to be added to the system- Throws:
FlightBookingSystemException- If a customer with the same ID already exists in the system
-
getCustomers
Retrieves an array of all customers in the system.- Returns:
- An array of all customers in the system
-
issueBooking
public void issueBooking(Customer customer, Flight flight, LocalDate bookingDate) throws FlightBookingSystemException Issues a booking for a customer on a flight with the specified booking date.- Parameters:
customer- The customer for whom the booking is issuedflight- The flight for which the booking is issuedbookingDate- The date on which the booking is made- Throws:
FlightBookingSystemException- If the customer or flight does not exist in the system, or if the flight is at full capacity
-
getBookings
Retrieves an array of all bookings in the system.- Returns:
- An array of all bookings in the system
-
cancelBooking
Cancels a booking for a given customer and flight.- Parameters:
customerId- The ID of the customerflightId- The ID of the flight- Throws:
FlightBookingSystemException- If the customer or flight does not exist in the system
-
removeFlight
Removes a flight from the system.- Parameters:
flightToDelete- The flight to be removed from the system
-
getBookingByID
Retrieves a booking by its ID.- Parameters:
bookingID- The ID of the booking to retrieve- Returns:
- The booking with the specified ID
- Throws:
FlightBookingSystemException- If no booking exists with the given ID
-
getCustomerByName
Retrieves a customer by their name.- Parameters:
customerName- The name of the customer to retrieve- Returns:
- The customer with the specified name
- Throws:
FlightBookingSystemException- If no customer exists with the given name, or if multiple customers with the same name exist and none is selected
-
getFlights
Retrieves a list of all future flights in the system.- Returns:
- A list of all future flights in the system
-
addFeedback
Adds feedback for a specific booking.- Parameters:
bookingID- The ID of the booking for which feedback is providedcustomerID- The ID of the customer providing feedbackmessage- The feedback message provided by the customer
-
getFeedbacks
Retrieves all feedback provided by customers.- Returns:
- A list of all feedback provided by customers
-
addFeedback
-