MAKE CODE ACCORDING TO THE TEMPLATE PROVIDE AT THE END OF THE QUESTION . MATCH INPUT AND OUTPUT AS IT IS. --------------------START--------------------------- Write a C++ program to calculate the mileage of the car. 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. Create separate classes in separate files. The class Car with the following private member variables. Data type Variable name string source string destination float kilometersTravelled float consumedFuel Include appropriate getters and setters for the above class. Include the following member function in the Car class. Method Member Function void calculateMileage() To calculate the mileage of the car. Note : Use this pointer. Print the mileage of the car with two decimal places. Input and Output Format: Please refer to the sample input and output for formatting specifications. [All text in bold are input and the remaining are output] Sample Input and Output 1: Enter the Source : Chennai Enter the Destination : Bangalore Enter the Number of kilometers travelled : 345 Enter the consumed Fuel : 12 Mileage of the car :28.75 Sample Input and Output 2: Enter the Source : Mumbai Enter the Destination : Delhi Enter the Number of kilometers travelled : 167 Enter the consumed Fuel : 11 Mileage of the car :15.18 -----------------------END---------------- IN ATTACH IMAGE TEMPLATE IS PROVIDED FOR THE MAIN.CPP AND CAR.CPP . KINDLY CHECK BEFORE MAKING CODE
MAKE CODE ACCORDING TO THE TEMPLATE PROVIDE AT THE END OF THE QUESTION . MATCH INPUT AND OUTPUT AS IT IS.
--------------------START---------------------------
Write a C++ program to calculate the mileage of the car.
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. Create separate classes in separate files.
The class Car with the following private member variables.
Data type | Variable name |
string | source |
string | destination |
float | kilometersTravelled |
float | consumedFuel |
Include appropriate getters and setters for the above class.
Include the following member function in the Car class.
Method | Member Function |
void calculateMileage() | To calculate the mileage of the car. |
Note :
Use this pointer.
Print the mileage of the car with two decimal places.
Input and Output Format:
Please refer to the sample input and output for formatting specifications.
[All text in bold are input and the remaining are output]
Sample Input and Output 1:
Enter the Source :
Chennai
Enter the Destination :
Bangalore
Enter the Number of kilometers travelled :
345
Enter the consumed Fuel :
12
Mileage of the car :28.75
Sample Input and Output 2:
Enter the Source :
Mumbai
Enter the Destination :
Delhi
Enter the Number of kilometers travelled :
167
Enter the consumed Fuel :
11
Mileage of the car :15.18
-----------------------END----------------
IN ATTACH IMAGE TEMPLATE IS PROVIDED FOR THE MAIN.CPP AND CAR.CPP . KINDLY CHECK BEFORE MAKING CODE
Step by step
Solved in 2 steps with 1 images
- Recommended textbooks for youDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education