Write a program that takes the name of a car, the distance travelled in Kilometers, the amount of fuel consumed in liters, and the price of fuel per liter as input from a user. The program calculates the per liter fuel consumption of the car (distance travelled divided by the amount of fuel consumed), and total cost of the travel in rupees. The program should have a fuelEfficiency method that takes the consumption as a parameter. The method returns one of the following possible statements based on the consumption. If the consumption is greater than or equal to 20, it returns Your car is highly fuel efficient If the consumption is equal to or greater than 15 and less than 20, it returns Your car is fuel efficient If the consumption is equal to or greater than 15 and less than 20, it returns Your car is fuel efficient If the consumption is equal to or greater than 10 and less than 15, it returns Your car needs tuning Else you need to see a mechanic An example output is given below: Enter the name of your car: Alto Enter the distance you have travelled: 100 Enter the amount of fuel consumed in litres 10 Enter the price per litres in rupees: 120 The Name of your car is: Alto Your per litter consumption is: 10.0 The total cost is: 1200.00 Your car needs tuning
-
Notifications
You must be signed in to change notification settings - Fork 0
Write a program that takes the name of a car, the distance travelled in Kilometers, the amount of fuel consumed in liters, and the price of fuel per liter as input from a user. The program calculates the per liter fuel consumption of the car (distance travelled divided by the amount of fuel consumed), and total cost of the travel in rupees. The …
itxfida/Car-Engine-Efficiency
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Write a program that takes the name of a car, the distance travelled in Kilometers, the amount of fuel consumed in liters, and the price of fuel per liter as input from a user. The program calculates the per liter fuel consumption of the car (distance travelled divided by the amount of fuel consumed), and total cost of the travel in rupees. The …
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published