# need help to do a java program

Clock.java

Please review Chapter 8 and complete the following lab assignments.

Problem 5.1

In Chapter 8, the class Clock was designed to implement the time of day in a program. Certain application in addition to hours, minutes, and seconds might require you to store the time zone.

In this assignment, please do the following:

Implement class Clock – The detailed implementation source code for class Clock (Clock.java) can be found in the textbook (pages: 466-470).

Derive the class ExtClock from the class Clock by adding a data member to store the time zone. Add necessary methods and constructors to make the class functional. Also write the definitions of the methods and constructors.

Write a test program to test your program

(Hints: please look at the examples Class Rectangle and Class Box from pages 654-660; for testing this new derived class, please refer to Example 8-2 in Pages 470-471).

Problem 5.2

In the following problem, you will need to implement a superclass in step a) and then a subclass in step b).

Implement a superclass for the class Point. Here is the requirement. Write a A pint in the x-y plane is represented by its x-coordinate and y-coordiate. Design the class pointer that can store and process a point in the x-y plane. You should then perform operations on a point, such as showing the point, setting the coordinates of the point, printing the coordinates of the point, returning the x-coordinate, and returning the y-coordinate. Also write a program to test various operations on a point.

Develop a subclass â€“ class Circle based on the class you develop in a). Here is the requirement: Every circle has a center and a radius. Given the center, we can ddetermine the circleâ€™s area and circumference. Given the center, we can determine its position in the x-y plane. The center of a circle is a point in the x-y plane. Design the class Circle that can store the redius and center of the circle. Because the center is a point in the x-y plane and you design should derive the class Circle from the class Point you have done in step a). You should be able to perform the usual operations on a circle, such as setting a radium, printing radium, calculating and printing the area and circumference.