Multiple Choice
Consider the partial Date class below which represents a day of the year. public class Date
{
Private int month; // A value between 1 and 12
Private int day; // A value between 1 and the last day
// of the month
Public int getMonth() { return month; }
Public void setMonth(int newMonth)
{
If (newMonth >= 1 && newMonth <= 12) { month = newMonth; }
}
Public int getDay() { return day; }
Private int lastDayOfMonth()
{
Switch (month)
{
Case 9: case 4: case 6: case 11:
Return 30;
Case 2: return 28;
Default: return 31;
}
}
}
What type of method is setMonth?
A) mutator
B) accessor
C) constructor
Correct Answer:

Verified
Correct Answer:
Verified
Q22: Which class category has static methods and
Q24: Which of the following is an example
Q42: To use a public variable or method
Q44: When are statements in a class-level initialization
Q76: A theater needs a TicketCounter to keep
Q77: Which of the following statements describes the
Q78: Pre- and postconditions may be viewed as
Q79: Consider the method signature in the following
Q85: Which statement will import the static methods
Q85: Consider the partial JUnit test below, designed