Question: C++ Classes and Objects Subtask 7 Define a class with name Airport with following members: a private attribute with the name of the airport as
C++ Classes and Objects
Subtask 7
Define a class with name Airport with following members:
- a private attribute with the name of the airport as C++ string.
- a private attribute with name slot as array of pointers to flights (subtask 5) with 24 rows (for the hours of a day) and 60 columns (for the minutes of each hour of a day), getting initialised by null pointers (i.e. maximum 24*60 starts and landings each day; due to turbulences of the air and for security reasons at least one minute pause has to be inbetween two starts). In this array pointers to scheduled landings or starting flights in each minute of a day shall get stored.
- definition of a public constructor with a name as parameter to initialise the respective attribute.
- definition of a public destructor deleting the whole pointer array with all flight objects on heap.
- definition of a public function with name schedule having a LocalTime and a pointer to a flight as parameters without return value and storing the flight at the scheduled time slot.
- definition of a public function with name comment with a LocalTime and a string as parameters having no return value and storing the string as comment of the flight at this scheduled time slot.
- definition of a public function with name delay with two LocalTime parameters having no return value and storing the time in second parameter in the flight object at the scheduled time given in the first parameter.
- definition of a public function with name print with one parameter of above enumeration type from subtask 2 for arrivals or departures without return value. In its body write a table of all stored arriving flights or starting flight given by the parameter value (see example below).

Code done:
#include
//subtask 4 ostream& operator
//subtask 5 class Flight { private: ArrivalDeparture arrivalOrDeparture;
string code, destination, gate, checkIn, comment;
LocalTime expected;
public: Flight(ArrivalDeparture a,string c,string d,string g,string ci, string co = "") { arrivalOrDeparture = a; code = c; destination = d; gate = g; checkIn = ci; comment = co; } ~Flight();
string get_code() { return code; } string get_destination() { return destination; } string get_gate() { return gate; } string get_checkIn() { return checkIn; } string get_comment() { return comment; } LocalTime get_expected() { return expected; } void set_expected(LocalTime e) { expected = e; } void set_comment(string c) { comment = c; } bool is_arrival() { return arrivalOrDeparture == arrival; } bool is_departure() { return arrivalOrDeparture == departure; } void print(LocalTime l) { cout
Flight :: Flight(ArrivalDeparture a, string c, string d, string g, string ci, string co) { arrivalOrDeparture = a; code = c; destination = d; gate = g; checkIn = ci; comment = co; } Flight :: ~Flight() { cout
string Flight :: get_code() { return code; } string Flight :: get_destination() { return destination; } string Flight :: get_gate() { return gate; } string Flight :: get_checkIn() { return checkIn; } string Flight :: get_comment() { return comment; } LocalTime Flight :: get_scheduled() { return expected; } void Flight :: set_expected(LocalTime e) { expected = e; } void Flight :: set_comment(string c) { comment = c; } bool Flight :: is_arrival() { return arrivalOrDeparture == arrival; } bool Flight :: is_departure() { return arrivalOrDeparture == departure; } void Flight :: print(LocalTime l) { cout
DUSSELDORF AIRPORT ARRIVALS =========================== Flight From LH 2010 Munich EW 9347 Manchester Scheduled Expected Gate Check-in Comments 12:40 13:05 A04 14:50 B04 DUSSELDORF AIRPORT DEPARTURES == = = = = = = == = = = = = = = = = = = = == = = = = = Flight To AF 1307 Paris SU 2537 Moscow EW 9466 London-Heathrow LH 2011 Munich XQ 959 Izmir Scheduled Expected Gate Check-in Comments 09:10 B51 192-194 departed 10:40 031 252-255 boarding 11:15 B35 151-170 13:25 A40 115-120 Code Sharing 14:55 15:20 045 240-242 flight AF 1307 deleted flight SU 2537 deleted flight EW 9466 deleted flight LH 2010 deleted flight LH 2011 deleted flight EW 9347 deleted flight XQ 959 deleted Local Time Flight Airport expected slot 24*60 - minutes : Integer + LocalTime() + void set_time() + get_hour() + get_minute() + is_valid() - name : String + Airport) + -Airport() + schedule() + comment) + delay() + print() zone > TimeZone ACT CET CST EST GMT MSK PST UTC - code : String - destination : String - gate : String - checkin : String - comment; String + Flight() +-Flight + get_code() + get_destination() + get_gate() + get_checkin() + get_comment() + get_expected() + set_comment() + set_expected() + is_arrival() + is_departure() + print() arrivalOrDeparture > ArrivalDeparture arrival departure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
