Create a GUI interface Homework Help
Create a GUI interface to test your class
The user should enter amonth and a year. The program will display a page in
Print Previewmode of the calendar for the month (example below).
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Use an array to store the number of days in a month.
Use exception handling to deal with bad input data.
Here is problem 9 from the book:
Using the class
(Chapter 6, Programming Exercise 9),design the class Calendar
so that, giventhe month and the
year, we can print the calendar for that month.To print a monthly calendar,
you must know the first day of themonth and the number of days in that
month. Thus, you must storethe first day of the month, which is of the form Day
, andthe month and the year of the calendar. Clearly, the month
and theyear can be stored in an object of the form ExtDate
bysetting the day component of the date to 1, and the month and yearas
specified by the user. Thus, the classCalendar
has two data members: an object of typeDay
and an object of type ExtDate
Design the class Calendar
so that theprogram can
print a calendar for any month starting January 1,1500. Note that the day
for January 1 of the year 1500 was aMonday. To calculate the first day of a
month, you can add theappropriate number of days to Monday, January 1,
1500. For theclass Calendar
, include the
a. Determine the first day of the month for which thecalendar will be
printed. Call this operationfirstDayOfMonth
b. Set the month.
c. Set the year.
d. Return the month.
e. Return the year.
f. Print the calendar for the month.
g. Add the appropriate constructors to initialize the datamembers.