Define a class AnalogClock to display an analog clock on a panel as shown next. Use the class DigitalClock developed to keep track of the time. To draw an analog clock, you can use a circle for the face and three lines for the hour, minute, and second hands. Each hand extends from the center of the clock to a point determined by the following formulas:
xend = xcenter + lengthhand x sin Θ
yend = ycenter – lengthhand x cos Θ
Since there are 60 seconds in one minute, the angle Θ for the second hand is seconds x (2π / 60) and the angle Θ of the minute hand is (minutes + seconds / 60) x (2π / 60)
Because the clock face is divided into 12 hours, the angle for the hour hand is (hours + minutes / 60 + seconds / 602) x (2π / 12)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here