/**
* CarTest is a driver program for the class Car.
*
* @author Mr. Merlis
* @version 10/3/06
*/
public class CarTest
{
/**
* This tests the Car class.
*/
public static void main(String[] args)
{
Car myJeep = new Car(18, 19.3);
myJeep.fillTank(16);
myJeep.drive(250);
double gasLeft = myJeep.getGasInTank(); // an accessor you must provide
System.out.println("The gas remaining is " + gasLeft);
myJeep.drive(200); //expect an error, ran out of gas
/*
// ----- The try/catch below is something we will add on Thursday
try
{
myJeep.fillTank(30); //expect an error, overflow
}
catch (IllegalArgumentException e)
{
System.out.println("No gas added, amount too large");
}
*/
}//====================================================
}