@@ -0,0 +1,2256 @@
+import java.lang.*;%0Aimport java.util.*;%0A%0Apublic class TimeDelay extends TimerTask %7B%0A%0A    TimeDelay() %7B%0A        // do nothing%0A    %7D%0A    Timer timer;%0A    public TimeDelay(int seconds) %7B%0A        timer = new Timer();  // new Thread will be created%0A        timer.schedule(new TimeDelay(), seconds*10000); //delay in milliseconds%0A    %7D%0A%0A    public void run() %7B%0A        // do nothing%0A    %7D%0A%0A    public void timedelay1() %7B%0A        System.out.println(%22Function1 exited.%22);%0A    %7D%0A%0A    public void timedelay2() %7B%0A        for (int i = 0; i %3C= 10; ++i) %7B%0A            System.out.printf(%22Loading... %5Cn%22, i);%0A            try %7B%0A                Thread.sleep(600);%0A            %7D catch (InterruptedException ie) %7B%0A                System.out.println(ie.getMessage());%0A            %7D        %7D%0A        System.out.println(%22Function2 exited in 10 seconds.%22);%0A        timer.cancel();%0A    %7D%0A%0A    public void timedelay3() %7B%0A        for (int i = 0; i %3C= 10; ++i) %7B%0A            System.out.printf(%22Loading... %5Cn%22, i);%0A            try %7B%0A                Thread.sleep(600);%0A            %7D catch (InterruptedException ie) %7B%0A                System.out.println(ie.getMessage());%0A            %7D        %7D%0A        System.out.println(%22Function3 exited in 10 seconds.%22);%0A        timer.cancel();%0A    %7D%0A%0A    public void timedelay4() %7B%0A        for (int i = 0; i %3C= 10; ++i) %7B%0A            System.out.printf(%22Loading... %5Cn%22, i);%0A            try %7B%0A                Thread.sleep(600);%0A            %7D catch (InterruptedException ie) %7B%0A                System.out.println(ie.getMessage());%0A            %7D        %7D%0A        System.out.println(%22Function4 exited in 10 seconds.%22);%0A        timer.cancel();%0A    %7D%0A%0A    public void timedelay5() %7B%0A        for (int i = 0; i %3C= 10; ++i) %7B%0A            System.out.printf(%22Loading... %5Cn%22, i);%0A            try %7B%0A                Thread.sleep(600);%0A            %7D catch (InterruptedException ie) %7B%0A                System.out.println(ie.getMessage());%0A            %7D        %7D%0A        System.out.println(%22Function5 exited in 10 seconds.%22);%0A        timer.cancel();%0A    %7D%0A%0A    public static void main(String args%5B%5D) %7B%0A        TimeDelay t = new TimeDelay(10);%0A        t.timedelay1();%0A        t.timedelay2();%0A        t.timedelay3();%0A        t.timedelay4();%0A        t.timedelay5();%0A    %7D%0A%7D

add better approach