. flightRes pName: string //passenger name seatNo:int //seat number must be between 1 and 50 poption: int //payment opti

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

. flightRes pName: string //passenger name seatNo:int //seat number must be between 1 and 50 poption: int //payment opti

Post by answerhappygod »

Flightres Pname String Passenger Name Seatno Int Seat Number Must Be Between 1 And 50 Poption Int Payment Opti 1
Flightres Pname String Passenger Name Seatno Int Seat Number Must Be Between 1 And 50 Poption Int Payment Opti 1 (53.48 KiB) Viewed 58 times
Flightres Pname String Passenger Name Seatno Int Seat Number Must Be Between 1 And 50 Poption Int Payment Opti 2
Flightres Pname String Passenger Name Seatno Int Seat Number Must Be Between 1 And 50 Poption Int Payment Opti 2 (43.25 KiB) Viewed 58 times
. flightRes pName: string //passenger name seatNo:int //seat number must be between 1 and 50 poption: int //payment option (1 or 2 or 3 ) fcost: double //flight cost fdate :string //flight date destination: string //destination city origin :string //origin city totRes: static int //total number of reservations calculateCost(): void // calculates flight cost flightRes() //default constructor gettotRes(): static int //returns total number of reservations setpName(string):void setDestination(sting):void setOrigin(string):void checkSeatValidity(int): void wflightRes() Default Constructor Prompts user to enter passenger name, seat number, flight date, origin city, destination city from keyboard. Seat number should be between 1 and 50. In order to check seat number is valid or not, call checkSeatValidity() and send seat number entered by user. If seat number is invalid prompt user to another seat number until a valid number is entered. If the seat number that user enters is valid display a message as seen in the sample output. Additionally the seat number that is already reserved should not be reserved for any other passenger. Payment Options should be displayed so that the user can select the option that will be used to calculate flight cost. In order to calculate cost, after user selects option, calculateCost() should be called. (see sample output) Finally total number of reservations should be incremented by 1. Setter methods: Gets a value as parameter to change the corresponding data member. Destructor: Displays an appropriate message whenever the object is destroyed. Additionally there is a function called showflight( ) that has to be declared as a friend function. This friend function displays passenger name, seat number, flight date, origin city, destination city and flight cost in a row wise as seen in the sample output. Initialize static data member to 0 (zero). USE the 'this pointer in the entire method definitions of the class!!!

Write a main function that will do the following steps. Create an automatic object called resauto • Create a pointer object called resptr1 • Create a dynamic object resptr2 • Create a dynamic array object called resArr that holds information for 10 passengers. Note that since you have created only a default constructor, all objects should invoke the default constructor. • Change passenger name for automatic object to (Maria Bruno) • Call the necessary method to print the details of all objects you have created. • Call the necessary method that will print the total number of objects created. Explain which objects you have created will be destroyed automatically. If the objects will not be destroyed automatically which operator should be used? Show it in your code. Sample Output Enter passenger name: Sebnem Coban Enter seat no:120 Seat number is invalid!!! Re-enter seat number:10 Seat number 10 is reserved for Sebnem Coban Payment Options --Base cost is 250 TL for every flight-- 1. EMU students (%10 discount) 2. EMU - IT-MIS students (%15 discount) 3. Standard Passenger (no discount) Enter your choice (1,2 or 3):1 The flight cost is:225 Enter origin and destination: London Larnaca Enter flight date(DD-MON-YYYY):20-Jan-2017 Enter passenger name: HEE Passenger Name Seat No Origin Destination Flight Date Sebnem Coban 10 London Larnaca 20-Jan-2017 Cost 225 LEBO Number of reservations in this flight is:.....
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply