/** Code for a car which can drive, and fill up w/ gas. * @author Ian Barland * @version 2008.Sep.22 */ class Car { public static void main() { System.out.println("hi"); } double currGas; double odometer; double mileage; /** Constructor. * @param _mileage The new car's mileage (in miles per gallon). */ public Car( double _mileage ) { currGas = 0.0; odometer = 0.0; mileage = _mileage; } /** Fill up with gas. * @param numGals The number of gallons to add to the tank. */ public void addGas( double numGals ) { double updatedGasLevel; updatedGasLevel = currGas + numGals; currGas = updatedGasLevel; } /** Record that the car has been driven. * @param miles The number of miles driven. */ public void drive( double miles ) { currGas = currGas - miles/mileage; } /** Return how much gas remains in the tank (in gallons). * @return how much gas remains in the tank (in gallons). */ public double getGasInTank() { return currGas; } }