Lab 3
CS140

While in the lab do the following exercises, have the TA check your solutions before leaving the lab.

E3.9 Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/kilometer (you choose) and a certain amount of fuel in the gas tank. The default constructor should set the efficiency to 50% and the fuel level to 0 and the fuel capacity to 20 gallons. Supply a second constructor that will let the car's efficiency to be set to any efficiency. Supply a method drive that simulates driving the car for a certain distance reducing the amount of gasoline in the fuel tank. Also supply methods getGasInTank that returns the current amount of fuel in the tank and addFuel to add fuel to the tank.

If the drive method is ever called to go further than the amount of fuel in the tank will take it...print a message saying that you may run out of fuel.

Create a CarTester class that will test all of the methods of the Car class.