Advertisement
mBakr

Untitled

Oct 8th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. public class gclock
  2. {
  3.  
  4.     public static void main(String[] sArgs) throws IOException
  5.     {
  6.        //begin();
  7.    
  8.         int iH=0,iM=0,iS=0;    
  9.         int iUH,iUM,iUS,t1=0,t2=0;
  10.    
  11.         System.out.print("This program will run a digital clock for a specific amount of hours, minutes,\nand seconds.\nPlease enter these:\nHours: ");
  12.         iUH=oScan.nextInt();
  13.         System.out.print("Minutes: ");iUM=oScan.nextInt();
  14.         System.out.print("Seconds: ");iUS=oScan.nextInt();
  15.         System.out.println("The clock will stop at "+iUH+":"+iUM+":"+iUS);
  16.    
  17.         t2 = iUH + iUM + iUS;
  18.    
  19.         while(true)
  20.         {
  21.             for(iH=0;iH<=24;iH++)
  22.             {
  23.                 for(iM=0;iM<=59;iM++)
  24.                 {
  25.                     for(iS=0;iS<=59;iS++)
  26.                     {
  27.                         System.out.print(iH+":"+iM+":"+iS);
  28.                         try{Thread.sleep(1000);}catch(Exception e){}
  29.                         System.out.print("\r");
  30.  
  31.                         if (t1 == t2)
  32.                         {
  33.                            // end();
  34.                            return;
  35.                         }
  36.                        
  37.                         t1++;
  38.                     }
  39.                 }
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement