Write a Java application to calculate the fuel efficiency of a motor vehicle as per the guidance given
below.
1. Implement a class named 'Car' which satisfies the following criteria.
The car is fuel driven and it has a fuel efficiency measured in litres/km
Initially certain amount of fuel is left in the tank.
Use a constructor to calculate the fuel efficiency.
Create a method called 'drive()' to simulate the driving of the car for some distance so that the
fuel level is dropped by some value.
Crate methods for the following:
i) getFuelInTank() – Should return the amount of fuel in the tank in litres.
ii) pumpFuel() – To add fuel to the tank
iii) fuelLeft() – Should indicate the remaining amount of fuel in litres.
Note: Assume a value to indicate the maximum capacity of the fuel tank and the distance travelled
should be within this limit. You may need an initial validation before the
Answers
Answered by
10
Answer:
hnnnnn,jkh
Explanation:
Similar questions