The objective of this assignment is to become familiar with objects, and modeling with object types (classes). You will not write any code for this assignment, rather you will analyze two applications to determine what object types and containers are needed (saying what the containers store, but no need for saying specific data structures), what fields are needed for each class, and what operations are needed in each class (no return types or parameters needed, but make operation names descriptive). No need to be too detailed.
1: Flight Reservation System Consider a flight reservation system that is to keep track of passengers and their flights. A passenger can have several flights booked at a time, and a flight will have several passengers. The booking of a flight by a passenger can include seat selection.
Answer-
Coming to the Flight class, this should contain the flight operator, flight model, flight number, number of passengers, time of the journey etc in order to appropriately distinguish each flight.
For the passenger class, there would be the variables first name, last name, passport number, date and time of journey, source of journey, destination of journey, seat number, flight number , etc would be the main fields in order to differentiate a person.
Methods can be written(such as getters and setters): getters can be used to effectively retrieve the information of a particular booking id and setters can be used to place the particular variables in the objects of the particular class, where objects are person's details and the flight details. For booking a ticket, a setter method can be used to insert information for a particular object.
Get Answers For Free
Most questions answered within 1 hours.