import java.util.*;

public class AutomobileMain1 {
  public static void main(String[] args) {
    Automobile car1 = new Automobile("Chevrolet", "Cruze", 2011, "1G1JF27W8GJ178227");
    Automobile car2 = new Automobile("Ford", "Taurus", 2010, "1G1BK13WBB265789");
    int numCars = 2;
    ArrayList<Automobile> cars = new  ArrayList<Automobile>();
    cars.add(car1);
    cars.add(car2);
    
    // count Fords
    int countFords = 0;
    for (int i = 0; i < numCars; i++) {
      if (cars.get(i).getMake().equals("Ford")) {
        countFords++;
      }
    }
    System.out.println("#Fords = " + countFords);
    // find oldest car's year
    int oldYear = cars.get(0).getYear(); // init. running min year
    for (int i=0; i< cars.size(); i++) {
      if (cars.get(i).getYear() < oldYear) {
        oldYear = cars.get(i).getYear();
      }
    }
    System.out.println("oldest car is "+ oldYear);
    // find oldest car
    Automobile oldCar = cars.get(0);  // init running min car
    for (int i=0; i < cars.size(); i++) {
      if (cars.get(i).getYear() < oldCar.getYear()) {
        oldCar = cars.get(i);
      }
    }
    System.out.println("oldest car is a " + oldCar.getYear() + oldCar.getMake());
    Collections.sort(cars);
       for (int i=0; i < cars.size(); i++) {
         System.out.println( "car " + i + cars.get(i).getVIN());
       }
    }

} 
    