Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 ( Composition ) : / / 1 5 / / Preparation: 1 . Create a new NetBeans project called Question 1 . 2
Question Composition:
Preparation:
Create a new NetBeans project called Question
In the extracted provided files, under folder Q you will find the files needed for this question.
Add the provided Hand.jar file to the Libraries for Question project.
Remember to Edit the Hand library and add the extracted javadoc folder as the Javadoc for this library.
Create a new class called AnalogueWatch for the Question project and complete it as described below.
The questions:
An analog watch, also called an analogue watch, is a timepiece that displays the time using hands on a traditional clock face, as opposed to a digital display
that shows the time in numerals. The analog watch has different parts but the most important are the face and the hands.
The face is the front of the watch, where the hands and markings are located. It is usually made of glass or plastic and can be round, square, or other shapes.
The hands are the pointers that rotate around the face to indicate the time. There are typically three hands:
Hour hand: The shorter hand that points to the hour.
Minute hand: The longer hand that points to the minute.
Second hand: A very thin hand that sweeps around the face once every minute.
For this question, it is expected of you to create a concrete class called AnalogueWatch that represents an analogue watch. Follow the instructions in the
description table Table and the information given in the UML diagram Table and complete the AnalogueWatch class.,
oop.ctanaloguewatch.AnalogueWatch
faceType: String
faceShape: String
hoursHand: Hand
minuteHand: Hand
secondHand: Hand
AnalogueWatchchar char, Hand, Hand, Hand
AnalogueWatchchar char, char, char, char, int, int, int
getHoursHand: Hand
getMinuteHand: Hand
getSecondHand: Hand
handNameHand: String
faceDetailschar: String
showTime: String
Table UML Class Diagram AnalogueWatch
MemberMethod Description Marks
faceType
faceShape
hoursHand
minuteHand
secondHand
These are instance data members of the AnalogueWatch class. As described above, the watch
face type is either glass G or plastic P and the shape is either round R square S or
other O
The watch will have an hour, minute, and second hand.
AnalogueWatchchar char, Hand, Hand,
Hand
The parameterized constructor will receive as parameters the characters that represent the
shape and type of the face of the watch. It also receives the Hand objects for the watch.
It must use these parameters to initialize the instance data members.
The constructor will invoke the faceDetails method twice to set the data members
faceType and faceShape with the correct values.
AnalogueWatchchar char, char, char, char,
int, int, int
The overloaded parameterized constructor will receive as parameters the characters that
represent the shape and type of the face of the watch.
The constructor will invoke the faceDetails method twice to set the data members
faceType and faceShape with the correct values.
The next characters and the int parameters are the values that should be used to initialize
the Hand instance data members.
getHoursHand
getMinuteHand
getSecondHand
Mutator methods.
handNameHand The facilitatorhelper method is used to find the description or name of the hand on the watch.
It will receive a Hand object as a parameter.
If the length attribute of the hand is L then the name is Minute hand
If the length attribute of the hand is S then the name is Hour hand
If the length attribute of the hand is T then the name is Second hand
faceDetailschar The facilitatorhelper method is used to find the description of the face of the watch. It will
receive a char as a parameter.
Table Class Description AnalogueWatch
Submitting your answers:
Following the instructions on EC under section submit your answers for this question.
The watch face type is either GlassG or PlasticP and the shape is either RoundR
SquareS or OtherO
showTime This method returns a description of the time that is being displayed on the face of the watch.
The return description will always start with The hands on the watch is as follows:
Examples of the returning description:
Remember it will only return the String content to display, not the message box.
Step 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