The Car class models a car in terms of:
MPG = miles per gallon,gas in the gas tank, andodometer reading (the total number of miles the car has traveled)Write the Car class with a constructor that initializes variables as needed, and four methods:
addGas(amount) - adds an amount of gas to the gas tankcheckGas() - returns the current amount of gas in the tankgetMiles() - returns the current odometer readingdrive(distance) - causes the odometer to be updated and gas to be used according to the MPG rating of the car. Note that the car should not be able to drive any farther than allowed by the amount of gas in the tank.Write a CarTester.java with a main() method that demonstrates the use of the Car class.