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
Q42: Which of the following statements regarding static
Q42: Where in a class should static variables
Q43: An AssertionError will be generated under which
Q44: The use of the static keyword in
Q47: It has been suggested the accessor method
Q48: Consider the method signature in the following
Q50: Which of the following statements is generally
Q50: Which command would execute a program with
Q51: Which of the following statements is true
Q55: Which of the following types of methods
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents