import RitIo;
class TestFuelLog {
public static void main(String args[]) {
double initialMileage; // initial mileage reading
double mileage; // mileage reading
double gallons; // amount of fuel at a stop
double milesPerGallon;
FuelLog log;
// Get initial mileage and create a new fuel log
initialMileage = RitIo.getDouble("Initial mileage: ");
log = new FuelLog(initialMileage);
// Process readings from the first gas station stop
System.out.println("Readings from the first gas " +
"station stop:");
mileage = RitIo.getDouble("Mileage: ");
gallons = RitIo.getDouble("Gallons: ");
log.fillUp(mileage, gallons);
System.out.println("Miles per gallon: " +
log.milesPerGallon());
// Process readings from the second gas station stop
// ...
}
}
|