Tuesday, November 22, 2011

Lab 9 - Gregor.java

You are to complete exercise 7.5
(6th ed, p257; 7th ed, p261) /
8.5 (8th ed, p296).

The class name must be Gregor and your program must use methods from the GregorianCalendar class. You may write it as a command line or as a GUI application.

There are a couple of ways to handle printing the name of the month. The simplest way is to hard-code a String array of month names

   String[] monthNames =
      { "January", "February", "March", "April",
        "May", "June", "July", "August", "September",
        "October", "November", "December" };


but that's kind of a kluge. The slicker and more accepted way is to take advantage of the getMonths method of the DateFormatSymbols class.

   String[] monthNames = (new DateFormatSymbols()).getMonths();

Sample Output
Here are screenshots of my code running.

Gregor output

Gregor GUI output

Refer to the deliverables post for comment formatting and required program identification information.

Due Date:
Monday, November 28th, 8:00am