Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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):

image text in transcribed

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, specifically

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago