Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Write a C++ main function with following definitions and statements: Define an object of type Airport initialized with name DUSSELDORF AIRPORT . Successively send

C++

Write a C++ main function with following definitions and statements:

  • Define an object of type Airport initialized with name DUSSELDORF AIRPORT.
  • Successively send to this object appropriate messages with new objects of type Flight on heap and with the scheduled time as parameters including all example flight data shown below. Also send appropriate messages to store comments and delays as shown below. Only defined constructors and member functions are allowed to be used and called, no further or changed member functions, constructors, additional or deleted parameters or changed visibilities of class member data.
  • Send to the object for Dusseldorf airport a message print to output the table of arrivals and a second message to output all departures.

Output must be:

image text in transcribed

Code done:

#include #include using namespace std;

//subtask 1 enum TimeZone { ACT, CET, CST, EST, GMT, MSK, PST, UTC };

//subtask 2 enum ArrivalDeparture { arrival, departure };

//subtask 3 class LocalTime { private: int minutes; TimeZone tz; public: LocalTime() { minutes = -1; tz = CET; } // LocalTime(int h, int m, TimeZone t) // { // set_time(h, m); // tz = CET; // } void set_time(int h, int m) { if (h >=0 && m >=0) minutes = m+h*60; else minutes= -1; } int get_hour() { return minutes / 60; } int get_minute() { return minutes % 60; } bool is_valid() { return minutes >=0 ; } };

//subtask 4 ostream& operator

//subtask 5 class Flight { private: ArrivalDeparture arrivalOrDeparture; string code, destination, gate, checkIn, comment; LocalTime expected;

public: Flight(ArrivalDeparture,string ,string ,string ,string , string); ~Flight(); string get_code(); string get_destination(); string get_gate(); string get_checkIn(); string get_comment(); LocalTime get_expected(); void set_expected(LocalTime e); void set_comment(string c); bool is_arrival(); bool is_departure(); void print(LocalTime l); };

//subtask 6 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() {}

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_expected() { 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

//subtask 7 class Airport { private : string name; int *slot[24][60]; public : Airport() {} ~Airport() {} void schedule(LocalTime lt, Flight *slot) {} void comment(LocalTime lt, string comment()) {} void delay(LocalTime lt1, LocalTime lt2) {} void printa(ArrivalDeparture arrival) { string s1 ("DUSSELDORF AIRPORT ARRIVALS"); string s2 ("==========================="); string s3 ("Flight From Scheduled Expected Gate Check-in Comments"); cout DUSSELDORF AIRPORT ARRIVALS Flight Scheduled Expected Gate Check-in Comments From LH 2010 Munich 12:40 13:05 A04 EW 9347 Manchester 14:50 B04 DUSSELDORF AIRPORT DEPARTURES Flight Scheduled Expected Gate Check-in Comments To AF 1307 192-194 departed Paris B51 09:10 SU 2537 252-255 boarding C31 Moscow 10:40 EW 9466 London-Heathrow 11:15 B35 151-170 Code Sharing Munich A40 LH 2011 13:25 115-120 XQ 959 Izmir 14:55 15:20 C45 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 DUSSELDORF AIRPORT ARRIVALS Flight Scheduled Expected Gate Check-in Comments From LH 2010 Munich 12:40 13:05 A04 EW 9347 Manchester 14:50 B04 DUSSELDORF AIRPORT DEPARTURES Flight Scheduled Expected Gate Check-in Comments To AF 1307 192-194 departed Paris B51 09:10 SU 2537 252-255 boarding C31 Moscow 10:40 EW 9466 London-Heathrow 11:15 B35 151-170 Code Sharing Munich A40 LH 2011 13:25 115-120 XQ 959 Izmir 14:55 15:20 C45 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions