SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 392.9k

program development assistance ? flights info

Feb 17 2014 6:27 AM
Hi
 

For this program you will write a simple class and demonstrate its use doing some straightforward

editing.

Write a class representing an airline flight. A Flight has the following data members:

â?¢ Airline (a string)

â?¢ Flight number (integer, must be > 0)

â?¢ Origin airport (a string, specifically a 3-character airport code)

â?¢ Destination airport (3-character airport code)

â?¢ Departure time (24-hour time, expressed as an integer, e.g. 11:30 AM is 1130, 2:15 PM is

1415).

â?¢ Arrival time (24 hour time, same format as departure time).

You will need a default constructor (one that takes no parameters), which sets all integer variables to 0

and leaves all strings as the empty string. You will also need a constructor that takes the above

parameters, in order. (You can either write 2 constructors or write a single constructor with default

values for all parameters.) Your program will also need getters and setters for all data items. The setter

for the airline should check that the airline code is at least 2 and no more than 4 characters long. The

setter for the arrival and departure airport should check that the airport code is 3 characters long.

Arrival and departure times should be no less than 0 and no greater than 2359. Attempts to set values

that do not meet these standards should result in a brief error message, and the data should not be

changed in the object.

You will also need member functions to read the object's data from an input stream and write it to an

output stream. The output function should write all data on one line, with appropriate spacing between

items for readability.

Your main program will be a menu-driven program with the following options for the user:

1. Add a flight

2. Delete a flight

3. Edit a flight

4. Show all arrivals for one airport

5. Show all departures for one airport

6. List all flights

7. Quit

Option 1 should prompt the user regarding what to enter, then call the method (member function) to

read the data from cin. Option 2 should ask the user for the airline and flight number. If there is no such

flight stored, a brief error message should be displayed; otherwise the flight should be removed. Option

3 should ask the user for the airline and flight number; if no such flight is stored, print a brief error

message; otherwise use the member function to print the flight's data to cout, then ask the user to enter

updated information. Options 4 and 5 should select arrivals/departures and display them as appropriate,

based on airport codes submitted by the user. Option 6 should list all flights, regardless of airport or

scheduled times.



Edit: Must be made out of visual Studio 2010-2012

 
Regards 
 

Answers (14)