联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> C/C++程序C/C++程序

日期:2023-11-24 07:57

Introduction

You are going to develop a “Flight Schedule Management System” that runs in the command line environment. The system stores the schedule and status of arrival and departing flights of Lion Rock City. Users of the system will be airport personnel, who can make changes and search for information about the flight schedule and status.  

Tasks

?You are required to write a Win32 Console Application program called FSMS.cpp.  
Program Requirements

R0 When the program starts, the console should display a welcome message, followed by the Main Menu of the program. Users can enter the options of the corresponding actions (see R1 to R6 below).

Welcome Message designed by your group
*** Main Menu ***
[1]Load Starting Data
[2]Edit Airline
[3]Show Schedule
[4]Search Flight [5] Edit Flight [6] Credits and Exit
***************** Option (1 - 6):

R1
[1] Load Starting Data

When the user inputs 1 in the Main Menu, the system is loaded with starting data. The starting data includes records of (1) airline, and (2) flight information as shown in R1.1 below. After the starting data is loaded, the system returns to the Main Menu.
R1.1
The starting data to be loaded, together with the required data format of the data fields, are described below.
Airline records
 
Flight Code Prefix Airline Name
BA British Airways
CX Cathay Pacific
HX Hong Kong Airlines
JL Japan Airlines
UO Hong Kong Express

Data format of each field:
?Flight Code Prefix: A string with two letters
?Airline Name: A string that may contain white space (assume at most 100 characters long)

Flight information records
 
Flight Code Date Time Origin/ Destination Status Direction
CX251 12/09/23 12:15SYDOn Time Arrival
BA732 20/11/23 06:55LHROn Time Arrival
JL114 12/10/23 14:45NRTDelayed Arrival
UO711 15/12/23 09:00ICNOn Time Arrival
CX651 30/09/23 15:55KHHCancelled Arrival
HX892 01/11/23 18:00BKKDelayed Departing
UO417 15/12/23 15:55SINOn Time Departing
BA337 22/10/23 23:50MANOn Time Departing
CX657 09/11/23 21:00NYCDelayed Departing
JL228 15/10/23 19:00CTSCancelled Departing


Data format of each field:
?Flight Code: A string which starts with two letters (the existing flight code prefix), followed by three digits
?Date: The date of arrival or departure of the flight, taking the format “DD/MM/YY”
?Time: The time of arrival or departure of the flight, taking a 24-hour format “hh:mm”
?Origin/ Destination: The origin (or destination) airport of the arrival (or departing) fight in the form of a 3-character airport code
?Status: Status of the flight, which can be “On Time”, “Delayed”, “Cancelled” ? Direction: A field that indicates whether the flight is arriving or departing Lion Rock City
R1.2
Options 2 to 5 in the Main Menu are enabled only after the system is loaded with the starting data. If the user enters options 2 to 5 before starting data is loaded, an error message should be shown, and then the system returns to the Main Menu.
R2
[2] Edit Airline

[After the starting data is loaded] When the user inputs 2 in the Main Menu, the system displays all the fields of all airline records in the form of a table. The user then can choose to (1) add a new airline, (2) edit an existing airline, or (3) delete an existing airline. After the editing, the updated airline table (for successful editing operations) or result of the editing operation (for unsuccessful editing operations) should be shown. The system then returns to the Main Menu.
R2.1

Your program needs to check against invalid operations on airline editing. In particular:
?The flight code prefix should be in correct format, and it should be unique in the system. Adding a new airline with an existing flight code prefix, or one with incorrect format should result in an error (unsuccessful editing operation).
?The user inputs the flight code prefix to choose the airline to edit. Only the airline name can be changed for an existing airline record.
?The user inputs the flight code prefix to choose the airline to delete. An airline can be deleted only if there is no flight associated with it from the flight information.
?During airline edit or delete, a wrong flight code prefix input results in an error (unsuccessful editing operation).
R3
[3] Show Schedule
[After the starting data is loaded] When the user inputs 3 in the Main Menu, the system prompts for the next input from user to choose displaying either the flight arrival schedule or the flight departure schedule. After getting the user’s selection, the flight schedule should be displayed neatly in a table format. The following fields should be included in the display: Flight Code, Date, Time, Origin/ Destination and Status. Flight records should be displayed in sorted order, from earliest to latest. After the schedule is shown, the system returns to the Main Menu.
[4] Search Flight
[After the starting data is loaded] When the user inputs 4 in the Main Menu, the Search
Flight Menu should be displayed, and the user can enter the options of the corresponding actions (see R4.1 to R4.3 below).
***** Search Flight Menu *****
[1] Search Flight by Flight Code [2] Search Flight by Origin/ Destination
[3] Search Upcoming Flights [4] Return to Main Menu
Option (1 - 4):
R4.1
[1] Search Flight by Flight Code

When such option is chosen, the system prompts for the flight code input by the user. All flight records that match the input flight code (anytime, for both directions) will be displayed. See R4.6 for the flight records display requirement.
R4.2
[2] Search Flight by Origin/ Destination

When such option is chosen, the system prompts for the airport code input by the user. All flight records that match the input airport code (anytime, for both directions) will be displayed. See R4.6 for the flight records display requirement.
R4.3
[3] Search Upcoming Flights

When such option is chosen, the system displays all flight records that are scheduled after the current date (the date when the program is executed). See R4.6 for the flight records display requirement.
R4.4
[4] Return to Main Menu
When such option is chosen, the system returns to the Main Menu.  
R4.5 Stay at the Search Flight Menu

Following R4.1, R4.2 and R4.3, after the information is displayed or error messages for wrong input, the system should return to the Search Flight Menu.

R4.6 Flight Records Display Requirement

The flight records retrieved under [4] Search Flight should be displayed in sorted order, from earliest to latest. The display should contain ALL fields from the flight information.

R5 [5] Edit Flight

[After the starting data is loaded] When the user inputs 5 in the Main Menu, he/she then can choose to (1) add a new flight, (2) edit an existing flight, (3) delete an existing flight, or (4) delete all cancelled flights. After the editing, result of the editing operation (changes made for successful editing, or error messages for unsuccessful editing) should be shown. The system then returns to the Main Menu.

R5.1 Your program needs to check against invalid operations on flight editing.  

Add a new flight record
?All fields for a flight record should be input, and in correct format.
?The system should not be added with duplicate flight records, i.e., records with same flight code, same date and same time.
?You can assume the system does not store more than 100 flight records.
?Any wrong inputs should result in an unsuccessful operation, and no update to the system data should be carried out.

Edit or delete an existing flight record
?The user inputs the flight code to select a record to edit or delete. If there are more than one records with the same flight code, the user is further prompted to choose which record to edit or delete by using a numeric input.
?For editing, only the flight status can be changed for an existing flight record.
?Any wrong flight code inputs should result in an unsuccessful operation, and no update to the system data should be carried out.

Delete all cancelled flights
? The system prompts for user’s “Yes/No” confirmation. If the user inputs ‘y’ or ‘Y’, all flight records with the “Cancelled” status should be removed from the system. If the user inputs ‘n’ or ‘N’, no update to the system data should be carried out.
R6

[6] Credits and Exit
When the user inputs this option, the system prompts for user’s confirmation. If the user inputs ‘n’ or ‘N’, the system returns to the Main Menu. If the user inputs ‘y’ or ‘Y’, the system displays the personal particulars (student name, student ID, tutorial group) of the group members and terminates. Other input is not acceptable and the system should ask the user to confirm again.
R7
Suitable checking on user’s input is expected, except in situations with assumptions stated in the requirements above. Appropriate error messages should be printed whenever unexpected situation happens, e.g., input value out of range, incorrect time format, etc.
R8
The use of functions (in addition to main function) and classes (i.e., OOP design) are expected in your program. Appropriate comments should be added in your source code file.
R9 Creativity and Critical Thinking: Use suitable format to present all required information of airline and flight schedule clearly and neatly. Additional features can be added.

Tips  

1.To handle unexpected input error (e.g. input a character to an integer variable), you may use the following code appropriately in your program: cin.ignore();    // Discard the content in the input sequence. cin.clear();     // Reset the input error status to no error.

2.To write codes about getting current date and comparing two dates, try to study further about the time(), mktime(), localtime() functions and the usage of “struct tm” structure under

.

相关文章

版权所有:留学生编程辅导网 2021,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。