Question
JAVA CODE (sample run and instructions below here): OR Alternatively use the following to aid in animation, a one second delay is useful, since the
JAVA CODE (sample run and instructions below here):
OR Alternatively use the following to aid in animation, a one second delay is useful, since the clock only updates once per second:
first code:
public class sleeper // test driver {
public static void main(String[] args)
{
System.out.println("Sleep for a while, ok just ten seconds...");
Delay.sleep(10);
}
}
second code:
// A simple class to delay specified number of seconds
public class Delay
{
public static void sleep(int numberOfSeconds)
{
if (numberOfSeconds
return;
try { Thread.sleep(numberOfSeconds*1000); // convert to seconds; sleep() takes ms.
}
catch(Exception e)
{
;
}
}
}
Write a Java graphics program that displays the time of day, on an analog clock, as shown below: ClockApp ClockApp ClockApp File Show File Show File Show Second Hand On Second Hand Off Exit HD Note that the clock has an hour, minute, and second hand, which in the (left-most) example shown above indicates the time of day as 4:12 and 17 seconds. Be sure your clock indicates the correct time of day, and updates, once per second, i.e. is animated. Listen carefully in class for hints on how to perform the animation. The File menu simply contains an Exit menu item; the Show menu depicts two choices, specifically "Second Hand On" and "Second Hand Off." For example, to perform the animation, consider using timers (highly suggested!), as shown on this web site, specificallyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started