
/**
 * Models a demolition derby by smashing a bunch of Cars together.
 * 
 * @author Zach Tomaszewski
 * @version Sep 12, 2007
 */
public class DemolitionDerby {

  /**
   * Creates three cars, smashes them up, repairs them, 
   * and checks their values.  Prints the results of each phase
   * to the screen.
   */
  public static void main(String[] args) {
    
    //create cars
    System.out.print("Creating three cars: ");
    Car orange = new Car("orange", 300);
    Car blue = new Car("blue", 150);
    Car rusty = new Car("rusty old", 100);    
    System.out.println("an " + orange + ", a " + blue + 
                     ", and a " + rusty + ".");
    
    //print values
    System.out.println("They have the following values:");
    System.out.println(orange + ": $" + orange.getValue());
    System.out.println(blue + ": $" + blue.getValue());
    System.out.println(rusty + ": $" + rusty.getValue());
    System.out.println();
    
    //smash them up a bit
    blue.crashInto(orange);
    orange.crashInto(rusty);
    blue.crashInto(rusty);
    
    //print values
    System.out.println("After a short and furious competition, " + 
                       "they have the following values:");
    System.out.println(orange + ": $" + orange.getValue());
    System.out.println(blue + ": $" + blue.getValue());
    System.out.println(rusty + ": $" + rusty.getValue());
    System.out.println();
   
    //repair them
    orange.repair(50);
    blue.repair(50);
    rusty.repair(50);

    //print values
    System.out.println("After quick repairs ($50 each), " + 
                       "they have the following values:");
    System.out.println(orange + ": $" + orange.getValue());
    System.out.println(blue + ": $" + blue.getValue());
    System.out.println(rusty + ": $" + rusty.getValue());
    System.out.println();
    
    System.out.println("This ends the demolition derby.");

  }

}
