import java.io.PrintWriter; import java.util.Scanner; class Caravan { int totalMiles; double totalGalsUsed; java.util.ArrayList myCars; Caravan() { this.totalMiles = 0; this.totalGalsUsed = 0.0; this.myCars = new java.util.ArrayList(); } void add(Car c) { if (c.getYearsOld() < 20) { this.myCars.add(c); } } public String toString() { String retval = "This is a caravan that has traveled " + this.totalMiles + " miles (and used " + this.totalGalsUsed + " gallons of gas).\n"; retval += "And it has these stellar vehicles:"; for (int i=0; i(); s.nextLine(); // throw away "Road trip!!" this.totalMiles = Integer.parseInt(s.nextLine()); this.totalGalsUsed = Double.parseDouble(s.nextLine()); try { while (true) { Car newCar = new Car(s); this.myCars.add(newCar); } } catch (Exception e) { } } void persist(PrintWriter pw) { pw.println("Road trip!!"); pw.println(this.totalMiles); pw.println(this.totalGalsUsed); for (int i=0; i