Write a C++ program to calculate the gravity of the petrol using multiple inheritance 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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a C++ program to calculate the gravity of the petrol using multiple inheritance
 
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY