Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

class ClockType { public void setTime(int hour, int min, int sec); public int ge

ID: 3675237 • Letter: C

Question

class ClockType
{
public void setTime(int hour, int min, int sec);
public int getTime();
public void printTime();
public void incrementSeconds();
private int hr;
public int min;
public int sec;
}

       7
       3
       10
       4
       An average of 5 because (7 + 3) / 2 = 5

Question 7.7. (TCO 1) Examine the ClockType class definition. How many methods does it contain?

class ClockType
{
public void setTime(int hour, int min, int sec);
public int getTime();
public void printTime();
public void incrementSeconds();
private int hr;
public int min;
public int sec;
}

(Points : 2)

Explanation / Answer

The number of methods in class ClockType is 4.
They are
public void setTime(int hour, int min, int sec);
public int getTime();
public void printTime();
public void incrementSeconds();

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

Method definition:
A method has return type methodName and arguments list in paranthesis.
Methods are used to set or edit the values of the class private members .
In class ClockType the four methods will satisfy the method definition.
Therefore , the correct option is 4