// TimeTest1A.java
// Tests class Time's 3-parameter constructor,
// toString, and all get methods.

public class TimeTest1A  {
   public static void main(String[] args)
   {
      if ( args.length < 3 )  {
         System.out.println("Use 3 command-line arguments "
                            + "representing an hour, minute, and second.");
         System.exit(0);
      }  // if

      try  {
         int hour = Integer.parseInt(args[0]);
         int minute = Integer.parseInt(args[1]);
         int second = Integer.parseInt(args[2]);
         testTime(hour, minute, second);
      } catch ( NumberFormatException nfe ) {
         System.out.println("User error: You entered \""
               + args[0] + " " + args[1] + " " + args[2]
               + "\" - should be integers only.");
      } catch ( IllegalArgumentException iae ) {
         System.out.println("User error: " + iae.getMessage());
      }  // catch
   }  // class main

   public static void testTime(int h, int m, int s)
   {
       Time t = new Time(h, m, s);
       System.out.println(t.to12HourString() + "   "
                          + t + "   " + t.getHour() + " hr, "
                          + t.getMinute() + " min, "
                          + t.getSecond() + " sec, or "
                          + t.getTotalSeconds() + " total seconds.");
       System.out.println("     Was " + h + " hr, " + m + " min, "
                          + s + " sec, or " + (3600*h + 60*m + s)
                          + " total seconds.");
   }  // method testTime
}  // class TimeTest1A