Skip to content

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 …

Notifications You must be signed in to change notification settings

itxfida/Car-Engine-Efficiency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Car-Engine-Efficiency

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

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

No packages published

Languages