Advertisement
GSculerlor

Untitled

Sep 14th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. public class MainTime
  2. {
  3.     public static void main (String[] args){
  4.         Time1 time = new Time1();
  5.        
  6.         System.out.println("Global time:");
  7.         System.out.println(time.toGlobalFormat());
  8.         System.out.println("AM/PM time:");
  9.         System.out.println(time.toAMPMFormat() + "\n");
  10.        
  11.         System.out.println("setTime(9, 8, 10)");
  12.        
  13.         time.setTime(9, 8, 10);
  14.        
  15.         System.out.println("Global time:");
  16.         System.out.println(time.toGlobalFormat());
  17.         System.out.println("AM/PM time:");
  18.         System.out.println(time.toAMPMFormat() + "\n");
  19.        
  20.         System.out.println("Test input setTime dengan range yang invalid");
  21.        
  22.         try{
  23.             time.setTime(50, 50, 50);
  24.         }
  25.         catch(IllegalArgumentException e){
  26.             System.out.println(e.getMessage() + "\n");
  27.         }
  28.        
  29.         System.out.println("Output after attempting out-of-range input");
  30.         System.out.println("Global time:");
  31.         System.out.println(time.toGlobalFormat());
  32.         System.out.println("AM/PM time:");
  33.         System.out.println(time.toAMPMFormat() + "\n");
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement