MULTIPLE INHERITANCE - CALCULATE HEAT COMBUSTION   Multiple Inheritance - Calculate heat of combustion Write a C++ program to implement multiple inheritance concepts and calculate the heat of combustion. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. Problem Constraint : Heat of combustion (Qv)=12,400-2,100d2   Where Qv is measured in calories per gram and d is the specific gravity at 60 °F (16 °C). The class Liquid has the following private data members. Data Type Variable Name float specificGravity Include necessary constructors, getters, and setters. In the Liquid class include the following member function. Function name Description Void display() This function is used to display the specific gravity The class Fuel has the following private data members. Data Type Variable Name float rate Include necessary constructors, getters, and setters. In the Fuel class, include the following member function. Function name Description Void display() This function is used to display the fuel rate per litre The class Petrol derived from Liquid class and Fuel class has the following private data members. Data Type Variable Name float heatCombustion string type Include necessary constructors, getters, and setters. In the Petrol class, include the following member function. Function name Description Void calculateHeatCombustion() This function is used to calculate the heat of combustion using the following formula Heat of combustion(Qv)=12,400-2,100d2 . void display() This function is used to display the heat of combustion value and to call the display function in the base class Liquid and fuel. Display heat of combustion value with respect to two decimal places. In the main method,  get the specific gravity, fuel rate per litre, and petrol type from the user. Create an object for the derived class and call the derived class display method. Input and Output format: Refer sample input and output for formatting specifications. [All Texts in bold corresponds to the input and the remaining corresponds to the output] Sample Input and Output: Enter the specific gravity 0.7 Enter fuel rate per litre: 0.99 Petrol type: Premium Fuel Details: Specific gravity:0.7 Fuel rate per liter:0.99 Heat of combustion(Q):11371.00

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

MULTIPLE INHERITANCE - CALCULATE HEAT COMBUSTION

 

Multiple Inheritance - Calculate heat of combustion


Write a C++ program to implement multiple inheritance concepts and calculate the heat of combustion.

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.


Problem Constraint :
Heat of combustion (Qv)=12,400-2,100d2  
Where Qv is measured in calories per gram and d is the specific gravity at 60 °F (16 °C).

The class Liquid has the following private data members.

Data Type Variable Name
float specificGravity
Include necessary constructorsgetters, and setters.


In the Liquid class include the following member function.

Function name Description
Void display() This function is used to display the specific gravity


The class Fuel has the following private data members.

Data Type Variable Name
float rate

Include necessary constructorsgetters, and setters.

In the Fuel class, include the following member function.

Function name Description
Void display() This function is used to display the fuel rate per litre


The class Petrol derived from Liquid class and Fuel class has the following private data members.

Data Type Variable Name
float heatCombustion
string type

Include necessary constructorsgetters, and setters.

In the Petrol class, include the following member function.

Function name Description
Void calculateHeatCombustion() This function is used to calculate the heat of combustion using the following formula
Heat of combustion(Qv)=12,400-2,100d2 .
void display() This function is used to display the heat of combustion value and to call the display function
in the base class Liquid and fuel. Display heat of combustion value with respect to two decimal places.


In the main method,  get the specific gravity, fuel rate per litre, and petrol type from the user. Create an object for the derived class and call the derived class display method.

Input and Output format:
Refer sample input and output for formatting specifications.
[All Texts in bold corresponds to the input and the remaining corresponds to the output]

Sample Input and Output:
Enter the specific gravity
0.7
Enter fuel rate per litre:
0.99

Petrol type:
Premium
Fuel Details:
Specific gravity:0.7
Fuel rate per liter:0.99
Heat of combustion(Q):11371.00

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education