NTIC Faculty L1/S2 2023–2024
Introduction to Object-Oriented Programming
Lab 3
(Packages, modifiers, constructors, getters, setters)
The goal is to implement a flight management system for an airline.
1. Create the classes Plane, Pilot, and Passenger in a package named Entities.
2. Create the classes Flight and Booking in a package named Program.
3. Implement the Plane class with private attributes {brand, model, capacity, year}, a constructor, and
access methods. The attributes brand, model, and year should not change.
4. Implement the Pilot class with private attributes {id, name, flightHours}, a constructor, and access
methods. The attribute id should not change.
5. Implement the Passenger class with private attributes {passportNb, name, surname, email, phone},
constructors with/without the attributes {email and/or phone}, and access methods.
6. Implement the Flight class with private attributes {flightId, plane, pilot, depCity, arvCity,
date}, a constructor, and access methods. The attribute flightId should not change.
7. Implement the Booking class with private attributes {bookingNb, passenger, flight, status}, a
constructor, and access methods. The booking number bookingNb is unique and sequential. The
attributes passenger and flight should not change.
8. Write the main method in a class named Airline that is not part of any of the Entities and Program
packages to:
(a) Enter information for creating 2 pilots, 2 planes, 4 passengers, 3 flights, and 6 bookings.
(b) Display the total number of registered passengers and the total number of flights.
(c) Cancel a booking.