Examlex

Solved

Consider the Partial Date Class Below Which Represents a Day

question 81

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?


Definitions:

French

relates to France or its people, language, or culture, a country known for its historical influence on art, science, and philosophy.

Intolerable Acts

A series of punitive laws passed by the British Parliament in 1774 meant to punish the Massachusetts colonists for the Boston Tea Party.

Continental Congress

The assembly of delegates from the Thirteen Colonies which became the governing body of the United States during the American Revolution.

Philadelphia

A historic city in Pennsylvania, significant for its role in the early history of the United States, including the signing of the Declaration of Independence.

Related Questions