146k views
3 votes
Clock-----------------------------------------hr: int-min: int-sec: int---------------------------------------+Clock()+Clock(int, int, int)+setTime(int, int, int) : void+getHours() : int+getMinutes() : int+getSeconds() : int+printTime() : void+incrementSeconds() : int+incrementMinutes() : int+incrementHours() : int+equals(Clock) : boolean+makeCopy(Clock) : void+getCopy() : Clock----------------------------------------According to the UML class diagram above, which of the following is a data member?

1. printTime()2. min3. Clock()4. Clock

User Shub
by
7.2k points

1 Answer

2 votes

Answer:

2.) min

explanation has been given below

Step-by-step explanation:

In the given example lets us create a unified modeling language

of the given statement.

Clock // name of class

--------------------------------------------------------------------------------

-hr :int

-min:int //data member

-sec:int

-----------------------------------------------------------------------------------

+Clock()

+Clock(int , int , int) //method name

+set Time(int, int , int):void

+get Hours():int

+getMinutes() : int

+getSeconds() : int

+printTime() : void

+incrementSeconds() : int

+equals(Clock) : boolean

+makeCopy(Clock) : void

+getCopy() : Clock-

At the top it contain the name of the class that is Clock.the middle box contain the data member.And the last box contain the methods name and parameters . + sign indicate it is a public member and - indicate it is private member.

User John Strong
by
7.5k points