Write a C++ program to calculate the gravity of the petrol using multiple inheritances   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.   Consider a class Liquid with the following protected member variable. Datatype Variables float density Include appropriate getter and setters.   Consider a class Fuel with the following protected member variable. Datatype Variables float rate Include appropriate getters and setters Consider a derived class Petrol derived from Liquid and Fuel and it contains the following member variables. Data Type Variable float gravity int thermalConductivity Include appropriate getters and setters Consider a class PetrolBO with the following method Method Method description void display(Petrol p) This method is used to display the petrol details. In the main method, inputs are obtained from the user and access the display method of PetrolBO by creating instances. Note:To calculate gravity use gravity = (density/997.0). Input and Output format: Refer to sample input and output for other further details and format of the output.   [All texts in bold corresponds to the input and rest are output] Sample Input and Output: Enter the details Enter the density of the petrol 560 Enter the rate of the petrol 89 Enter the thermal conductivity of the petrol 465 Density : 560 Rate : 89 Thermal Conductivity : 465 Gravity : 0.561685

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 29SA
icon
Related questions
Question
Write a C++ program to calculate the gravity of the petrol using multiple inheritances
 
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.
 
Consider a class Liquid with the following protected member variable.
Datatype Variables
float density

Include appropriate getter and setters.
 

Consider a class Fuel with the following protected member variable.
Datatype Variables
float rate
Include appropriate getters and setters

Consider a derived class Petrol derived from Liquid and Fuel and it contains the following member variables.
Data Type Variable
float gravity
int thermalConductivity

Include appropriate getters and setters

Consider a class PetrolBO with the following method

Method Method description
void display(Petrol p) This method is used to display the petrol details.


In the main method, inputs are obtained from the user and access the display method of PetrolBO by creating instances.

Note:To calculate gravity use gravity = (density/997.0).


Input and Output format:
Refer to sample input and output for other further details and format of the output.
 
[All texts in bold corresponds to the input and rest are output]
Sample Input and Output:

Enter the details
Enter the density of the petrol
560
Enter the rate of the petrol
89
Enter the thermal conductivity of the petrol
465
Density : 560
Rate : 89
Thermal Conductivity : 465
Gravity : 0.561685
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
ADT and 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
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr