// TimeTest2.java
// Tests class Time's 1-parameter constructor,
// toString, and all get methods.
public class TimeTest2 {
public static void main(String[] args)
{
if ( args.length < 1 ) {
System.out.println("Use 1 command-line argument "
+ "representing a total number of seconds.");
System.exit(0);
} // if
int totalSeconds = Integer.parseInt(args[0]);
testTime(totalSeconds);
} // class main
public static void testTime(int totalSeconds)
{
Time t = new Time(totalSeconds);
System.out.println(t.to12HourString() + " "
+ t + " " + t.getHour() + " hr, "
+ t.getMinute() + " min, "
+ t.getSecond() + " sec, or "
+ t.getTotalSeconds() + " total seconds.");
int h = totalSeconds / 3600;
int m = totalSeconds / 60 % 60;
int s = totalSeconds % 60;
System.out.println(" Was " + h + " hr, " + m + " min, "
+ s + " sec, or " + (3600*h + 60*m + s)
+ " total seconds.");
} // method testTime
} // class TimeTest2