Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class gclock
- {
- public static void main(String[] sArgs) throws IOException
- {
- //begin();
- int iH=0,iM=0,iS=0;
- int iUH,iUM,iUS,t1=0,t2=0;
- System.out.print("This program will run a digital clock for a specific amount of hours, minutes,\nand seconds.\nPlease enter these:\nHours: ");
- iUH=oScan.nextInt();
- System.out.print("Minutes: ");iUM=oScan.nextInt();
- System.out.print("Seconds: ");iUS=oScan.nextInt();
- System.out.println("The clock will stop at "+iUH+":"+iUM+":"+iUS);
- t2 = iUH + iUM + iUS;
- while(true)
- {
- for(iH=0;iH<=24;iH++)
- {
- for(iM=0;iM<=59;iM++)
- {
- for(iS=0;iS<=59;iS++)
- {
- System.out.print(iH+":"+iM+":"+iS);
- try{Thread.sleep(1000);}catch(Exception e){}
- System.out.print("\r");
- if (t1 == t2)
- {
- // end();
- return;
- }
- t1++;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement