Home / Expert Answers / Computer Science / part-1-create-a-new-package-named-hw6-create-an-abstract-parent-class-named-34-watch-34-based-on-the-pa619

(Solved): Part 1. Create a new package named HW6. Create an abstract Parent Class named "Watch" based on the ...





student submitted image, transcription available below
student submitted image, transcription available below
Part 1. Create a new package named HW6. Create an abstract Parent Class named "Watch" based on the UML in the package HW6. Add comments stating where data fields, constructors, toString () and other methods(if any). Part 2: Create two child classes named "Analog Watch" and "DigitalWatch" based on their UML respectively. Add comments stating where data fields, constructors, toString 0 and other methods(if any). "Timer" interface implementation given below: import java.time."; import java. tine, format, Datetinelormatter; publie interface Timer i public string how Tochangewatchtioe (): public default string getCurrentTine() 4 LocalDateTine now - LocalDateTime-now(), \} retura now, format (formatter); ) Part 4. Implement the relationship between interface and the classes as shown in the diagram below. You must correctly implement appropriate methods in your classes based on abstraction and interface principles. Part 5. Inside the main() method of the Watch class, do the following: a) Create a new instance of the "AnalogWatch" class using the overioaded constructor and assign it to the object reference of type "Watch". b) Create a new instance of the "DigitalWatch" class using the overloaded constructor and assign it to the object reference of type "Watch". c) Display the content of both the objects. d) Display the current time using the two objects created above respectively. NOTE: The values which you assign for the data fields when creating objects should be relevant and meaningful. Do not give irrelevant values. For example, an analog watch can only have up to 3 or rarely up to 4 hands. You cannot assign 10 hands to an analog watch.


We have an Answer from Expert

View Expert Answer

Expert Answer



We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe