/**
* A driver that can be used to test the Length class
*
* @author Prof. David Bernstein, James Madison University
* @version 1.0
* 
* @author Professor Elizabeth Adams, James Madison University
* @version 1.1
* @author Professor Nancy Harris, James Madison University
* @version 1.2
*/

public class Driver
{
   /**
   * The entry point of the application
   *
   * @param args The command line arguments
   */

   public static void main(String[] args)
	{
      Length billsHeight, growth, mikesHeight;
 
 	 	// test 2 paramter constructor
      mikesHeight = new Length(5, 5);
      billsHeight = new Length(5, 5);

	 	// test toString
      System.out.println("Age 12: ");
      printSummary("Mike", mikesHeight, "Bill", billsHeight);
       
	 	// get ready to test changeLength
	 	growth = new Length();
      mikesHeight.changeBy(growth);
	 
	 	//change length for both persons
      growth = new Length(0, 4);
      billsHeight.changeBy(growth);
      System.out.println("Age 16: ");
      printSummary("Mike", mikesHeight, "Bill", billsHeight);
  
  	 	// and again
      growth = new Length(1, 1);
      mikesHeight.changeBy(growth);
      growth = new Length(0,10);
      billsHeight.changeBy(growth);
      System.out.println("Age 20: ");
      printSummary("Mike", mikesHeight, "Bill", billsHeight);
       
	 	// test three parameter constructor (they begin to lose height)
	 	growth = new Length(0,1,false);
      billsHeight.changeBy(growth);
		System.out.println("Age 70: ");
      printSummary("Mike", mikesHeight, "Bill", billsHeight);
   }

   // Normally we would want the main method to be the only thing in a class.
   // However, this is simply a test class.  So the printSummary which supports the
   // testing will be permitted here.  This Driver will not be used when Length is fully
   // tested.
   
   /**
   * Print summary information for two Length objects
   *
   * @param name1 The name for the first Length
   * @param length1 The first Length object
   * @param name2 The name for the second Length
   * @param length2 The second Length object
   */

   private static void printSummary(String name1, Length length1,
                                    String name2, Length length2)
	{
      System.out.println(" " + name1 + ": " + length1); // Uses toString
      System.out.println(" " + name2 + ": " + length2); // Uses toString
       
  		// tests the equals length and uses its result to print a message.     
	 	if (length1.equals(length2))
      {
         System.out.println(" == SAME ==");
      } 
      else 
      {
    		System.out.println(" == DIFFERENT ==");
   	}
 		System.out.println("\n");
	}
}