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
MULTIPLE INHERITANCE - CALCULATE HEAT 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 |
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
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images