Create a file yul.cpp with the main function that asks the user to enter the information to create two flight objects. Then use printinfo() and Airline () functions to display the flight and airline information. Afterward by using the equals (ction the following results are displayed: (Text in green is user input) What flight are you looking for? AC975 What is the destination? France What is the departure time? 1458 What flight are you looking for? DL521.J What is the destination? New York. What is the departure time? 8538. The two flights are: AC975 flight to France at 14:50, Air Canada DL521 flight to New York at 85:38, Delta Are the two flights to the same destination? No What flight are you looking for? AC975. What is the destination? France What is the departure time? 1458 What flight are you looking for? AC863.J What is the destination? France. what is the departure time? 1830 The two flights are: AC975 flight to France at 14:50, Air Canada AC863 flight to France at 85:38, Air Canada Are the two flights to the same destination? yes

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 16SA
icon
Related questions
Question
Kindly Solve this C++ question as per the instructions. Thank you for your help!
 
Instructions:
1- Put the class definition in Flight.h and the implementation of the constructors and functions in Flight.cpp
Implement the Flight.h and Flight.cpp so that class Flight contains:
  • 4 private instance variables: Name of data type string, which describe the three electric vehicle charger types (AC975, DL521, and AC863). Destination of data type string that shows the final destination of that flight. Hour and Minute of data type int that show the departure time.
  • A default constructor which sets all of the numeric instance variables to zero and the String instance variables to null.
  • A constructor with 4 parameters that sets the 4 instance variables to the corresponding values passed.
  •  Implement an accessor method for each information (Flight name, Flight destination, and Flight Time) that will return the value of the instance variable. For example, the getX() method for the instance variables Hour and Minute must be called getTime().
  • Implement a mutator method for each instance variable that will assign to the instance variable to the value passed. For example, the setX() method for the instance variables Hour and minute must be called setTime().
  • An equals function: two objects of type flight have a similar destination or not. If they have similar destination, this function returns a Boolean value true.
  • An Airline function, which shows the airline operator of a flight based on the first two letters of its name:
    1) For flight AC975, it shows "Air Canada".
    2) For flight DL521, it shows "Delta"
  • printinfo function which prints out the flight information in the following format:
    (Name> flight to Destination> at <hour): (minute).
1- Put the class definition in Flight.h and the implementation of the
constructors and functions in Flight.cpp
Implement the Flight.h and Flight.cpp so that class Flight contains:
✔4 private instance variables: Name of data type string, which describe the three electric
vehicle charger types (AC975, DL521, and AC863). Destination of data type string that
shows the final destination of that flight. Hour and Minute of data type int that show the
departure time.
✔A default constructor which sets all of the numeric instance variables to zero and the String
instance variables to null.
✔A constructor with 4 parameters that sets the 4 instance variables to the corresponding values
passed.
✓ Implement an accessor method for each information (Flight name, Flight destination, and Flight
Time) that will return the value of the instance variable. For example, the getX() method for
the instance variables Hour and Minute must be called getTime ().
✓ Implement a mutator method for each instance variable that will assign to the instance variable
to the value passed. For example, the setX() method for the instance variables Hour and
minute must be called setTime().
✓An equals function: two objects of type flight have a similar destination or not. If they have a
similar destination, this function returns a Boolean value true.
✓An Airline function, which shows the airline operator of a flight based on the first two letters
of its name:
o For flight AC975, it shows "Air Canada".
o
For flight DL521, it shows "Delta".
Aprintinfe function which prints out the flight information in the following format:
(Name> flight to Destination) at chour): (minute).
Transcribed Image Text:1- Put the class definition in Flight.h and the implementation of the constructors and functions in Flight.cpp Implement the Flight.h and Flight.cpp so that class Flight contains: ✔4 private instance variables: Name of data type string, which describe the three electric vehicle charger types (AC975, DL521, and AC863). Destination of data type string that shows the final destination of that flight. Hour and Minute of data type int that show the departure time. ✔A default constructor which sets all of the numeric instance variables to zero and the String instance variables to null. ✔A constructor with 4 parameters that sets the 4 instance variables to the corresponding values passed. ✓ Implement an accessor method for each information (Flight name, Flight destination, and Flight Time) that will return the value of the instance variable. For example, the getX() method for the instance variables Hour and Minute must be called getTime (). ✓ Implement a mutator method for each instance variable that will assign to the instance variable to the value passed. For example, the setX() method for the instance variables Hour and minute must be called setTime(). ✓An equals function: two objects of type flight have a similar destination or not. If they have a similar destination, this function returns a Boolean value true. ✓An Airline function, which shows the airline operator of a flight based on the first two letters of its name: o For flight AC975, it shows "Air Canada". o For flight DL521, it shows "Delta". Aprintinfe function which prints out the flight information in the following format: (Name> flight to Destination) at chour): (minute).
Create a file yul.cpp with the main function that asks the user to enter the information to create two
flight objects. Then use printinfo() and Airline () functions to display the flight and airline
information. Afterward by using the equals(@pction the following results are displayed: (Text
in green is user input)
What flight are you looking for? AC975J
What is the destination? France
What is the departure time? 1458.
What flight are you looking for? DL521J
What is the destination? New York.
What is the departure time? 8530.J
The two flights are:
AC975 flight to France at 14:50, Air Canada
DL521 flight to New York at 85:30, Delta
Are the two flights to the same destination?
No
What flight are you looking for? AC975.J
What is the destination? Franced
What is the departure time? 1458.J
What flight are you looking for? AC863JJ
What is the destination? France
What is the departure time? 1830.
The two flights are:
AC975 flight to France at 14:50, Air Canada
AC863 flight to France at 85:38, Air Canada
Are the two flights to the same destination?
yes
Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify
the validity of user input.
Transcribed Image Text:Create a file yul.cpp with the main function that asks the user to enter the information to create two flight objects. Then use printinfo() and Airline () functions to display the flight and airline information. Afterward by using the equals(@pction the following results are displayed: (Text in green is user input) What flight are you looking for? AC975J What is the destination? France What is the departure time? 1458. What flight are you looking for? DL521J What is the destination? New York. What is the departure time? 8530.J The two flights are: AC975 flight to France at 14:50, Air Canada DL521 flight to New York at 85:30, Delta Are the two flights to the same destination? No What flight are you looking for? AC975.J What is the destination? Franced What is the departure time? 1458.J What flight are you looking for? AC863JJ What is the destination? France What is the departure time? 1830. The two flights are: AC975 flight to France at 14:50, Air Canada AC863 flight to France at 85:38, Air Canada Are the two flights to the same destination? yes Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the validity of user input.
Expert Solution
steps

Step by step

Solved in 5 steps with 7 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning