Advertisement
lamaulfarid

Time1Test

Oct 14th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. /**
  2.  * Write a description of class Time1Test here.
  3.  * Time1 object used in an application.
  4.  * @author Ahmad Lamaul Farid
  5.  * @version 08 Oktober 2020
  6.  */
  7. public class Time1Test
  8. {
  9.     public static void main( String[] args)
  10.     {
  11.         Time1 time = new Time1();
  12.        
  13.         System.out.print( "The initial universal time is: " );
  14.         System.out.println( time.toUniversalString() );
  15.         System.out.print( "The initial standard time is: " );
  16.         System.out.println( time.toString() );
  17.         System.out.println();
  18.        
  19.         time.setTime( 13, 27, 6);
  20.         System.out.print( "Universal time after setTime is: " );
  21.         System.out.println( time.toUniversalString() );
  22.         System.out.print( "Standard time after setTime is: " );
  23.         System.out.println( time.toString() );
  24.         System.out.println();
  25.        
  26.         try
  27.         {
  28.            time.setTime( 99, 99, 99 );
  29.         }
  30.         catch ( IllegalArgumentException e )
  31.         {
  32.            System.out.printf( "Exception: %s\n\n", e.getMessage() );
  33.         }
  34.        
  35.         System.out.println( "Afer  attempting invalid settings:" );
  36.         System.out.print( "Universal time: " );
  37.         System.out.println( time.toUniversalString() );
  38.         System.out.print( "Standard time: " );
  39.         System.out.println( time.toString() );
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement