import element.*; public class Month { public static void main(String args[]) { ConsoleWindow c = new ConsoleWindow(); int month, year, daysInMonth; boolean leapYear; c.out.println("Enter a month and year."); c.out.println("I'll print the length of the month."); month = c.input.readInt(); year = c.input.readInt(); // figure out leap year (works for years 1901-2099) leapYear = false; if (year%4 == 0) leapYear = true; switch (month) { case 4: // "Fourth, case 11: // eleventh, case 9: // ninth, case 6: // and sixth, daysInMonth = 30; // Thirty days to each affix; break; default: daysInMonth = 31; // Every other thirty-one break; case 2: // Except the second month alone." if (leapYear) daysInMonth = 29; else daysInMonth = 28; break; } c.out.println(month+"/"+year+" has "+daysInMonth+" days."); } } /* Enter a month and year. I'll print the length of the month. 2 2000 2/2000 has 29 days. */