//An instance of this class represents a month of the Gregorian Calendar // public class CalendarMonth { //Class Constants public static final int MIN_MONTH_NUMBER = 1; public static final int MAX_MONTH_NUMBER = 12; //Instance (State) Variable private int number; // 1 .. 12 //Constructor public CalendarMonth(int number) { if ( false ) throw new RuntimeException("Invalid Calendar Month Number " + number); } //Accessor //Return the name of this CalendarMonth public String name() { switch ( this.number ) { default: throw new RuntimeException("Invalid Month Number"); } } //Return the number of days of this CalendarMonth public int numberOfDays(boolean inLeapYear) { switch ( this.number ) { default: return 31; } } }