代写C代码 代做C程序 C辅导 C家教

远程写代码 Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

 

Dusseldorf airport plans to re-program the software showing departures in an object-oriented programming style in C++. In this task classes and an example as a first prototype shall be implemented.
 
Subtask 1
 
 
For security reasons at least one minute has to be in between two starts. Define an integer constant maxStarts for maximum 24?60 possible starts at one day.
 
Time points at airports are always given in local time. Define an enumeration with at least following eight time zones: ACT, CET, CST, EST, GMT, MSK, PST, UTC (more you can find here).
 
Subtask 2
 
 
Define a class with name LocalTime. This class shall have following members:
 
a private integer attribute minutes storing the minutes since midnight of a day (saving one variable instead of two for hour and minute).
 
a private attribute for the time zone of enumeration data type defined in subtask 1.
 
a public standard constructor initialising the time zone to CET and the minutes to -1 (time yet not set).
 
a public overloaded constructor with three parameters for the hour, minute and a time zone initialising the two (minutes calculated) respective attributes (hint: in the body simply call both following member functions).
 
a public method with name set_zone with a time zone as parameter assigning the parameter value to the respective attribute.
 
a public method with name set_time with an hour and a minute as parameters calculating the minutes since midnight and assigning the result to the respective attribute. Check that hour and minute are given correctly otherwise write an error message and assign value -1.
 
two public methods with names get_hour and get_minute without parameters calculating the hour or the minute and return the result (hint: integer division by 60 with rest).
 
a public method with name isValid without parameters returning false for a negative value for the minutes and true otherwise.
 
Subtask 3
 
 
Furthermore outside of the class an overloaded output operator << for an object of class LocalTime shall be defined. The local time shall always be outputted with 5 characters in form hh:mm, for example 00:00, 09:08 or 14:20.
 
Subtask 4
 
 
Define a class for departure flights with name Flight with following members:
 
two private attributes with names scheduled for the planned and expected for the real/expected departure time of above type LocalTime.
 
five private attributes with names no (flight number), to (flight time), gate (departure gate), checkIn (counters for dropping off baggage and check in) as well as comments (for comments on this flight) of type string.
 
a public prototype for a constructor with five parameters for the number of the flight, the flight destination, the scheduled/planned departure time, the departure gate and the check in counters.
 
a public prototype for a destructor.
 
seven public prototypes for getter functions with speaking names get_scheduled, get_expected, get_no, get_to, get_gate, get_checkIn and get_comments without parameters and appropriate return types.
 
two public prototypes for setter functions with also speaking names set_expected and set_comments with each one appropriate parameter.
 
Subtask 5
 
Define outside of the class with name Flight
 
the constructor initialising the given parameter values to the regarding attributes and the comment to an empty string (the expected/delayed departure time will be set automatically by the standard constructor).
 
the destructor.
 
the seven getter member functions.
 
the two setter member functions.
 
Subtask 6
 
 
Furthermore an overloaded output operator << for a reference to an object of class Flight shall be defined. This operator shall output one line of the departure table for the given as second parameter flight nicely formatted exactly as shown in the examples below.
 
Subtask 7
 
 
Write a C++ main function with following definitions and statements:
 
Define an array of maxStarts pointes of departure flights with name slot initialised by zero pointers at compile time.
 
 
Generate six new objects for examples of departure flights on the heap and assign six free ascending (arbitrarily chosen) time slots in the array slot. The six departure flights shall have exactly the example row data given below (therefore also the expected/delayed departure times and the comments; call additionally for these the respective setter funtions.
Only above 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. 
 
 
Following output the header lines of the departure table and afterwards the flights exactly as given in the example. Define a for-loop regarding all maxStarts time slots in the array and output all stored objects by calling the output operator defined in subtask 6 (regard the non null pointers).
 

相关推荐