1.    Create a base class called Passenger_Details with no_of_passengers and amount_of_Cargoes in kgs as attributes.  2.    Derive a class Airplane (type_of_engine[propeller,jet], range_in_miles).  3.    Define a pure virtual function named  travel_cost()  in the base class as follows, Virtual void travel_cost()=0;  4.    Reuse the travel_cost() function  and define it to calculate the cost in the derived class Airplane.       5.    Calculate cost based on  type of engine  and miles inside the travel_cost().

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 3.9CP
icon
Related questions
Question

Write a C++ program using inheritance and Virtual function.
1.    Create a base class called Passenger_Details with no_of_passengers and amount_of_Cargoes in kgs as attributes. 
2.    Derive a class Airplane (type_of_engine[propeller,jet], range_in_miles). 
3.    Define a pure virtual function named  travel_cost()  in the base class as follows,
Virtual void travel_cost()=0; 
4.    Reuse the travel_cost() function  and define it to calculate the cost in the derived class Airplane.      
5.    Calculate cost based on  type of engine  and miles inside the travel_cost().

Output Sample:
Type of engine
Range_in_miles
=
Cost
Type of engine
Range_in_miles
=
Cost
propeller (5000),
600
5000* Range__in_miles
jet (6000)
600
6000* Range_in_ miles
Transcribed Image Text:Output Sample: Type of engine Range_in_miles = Cost Type of engine Range_in_miles = Cost propeller (5000), 600 5000* Range__in_miles jet (6000) 600 6000* Range_in_ miles
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
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
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage