| Java Programming Spring 2003 Homework #4 |
|   Course Syllabus   |   Java Programming Home   |   HW4 FAQ   |   Assignment   |   How to submit |
| Assignment |
This assignment involves two independent projects. You need to do both projects!
Write a java program named cal (the main() should be in a class named "cal") that will print out to standard output the calendar for any month. Your program should look at the command line arguments for a numeric month and year, and print the calendar for that month in the format displayed below. If there are no command line arguments, or if the command line arguments are not a valid month and year, your program must print the calendar for the current month. This program is a java version of the Unix "cal" command. Sample usage of your program is shown below:
> java cal
March 2003
Su Mo Tu We Th Fr Sa
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 31
> java cal 4 2025
April 2025
Su Mo Tu We Th Fr Sa
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
|
As the above examples show, the program should print out the month and year, followed by the days of the week (using the same abbreviation as shown above) and the dates in the month. Your program must produce a tabular output exactly like the above examples, the only difference should be the exact position of the dates (which depend on the specific month asked for). It is required that the columns of the calendar line up just like the above examples!
This project involves the creation of a custom collection object that can be used to manage PIMEntities (from HW3). You must create a class named PIMCollection that implements the interface Collection. In addition to being a Collection, your class must implement the following methods:
| getNotes |
public Collection getNotes();
getNotes() returns a Collection that holds all the
PIMNote items currently in the PIMCollection. If there are no PIMNote items
in the PIMCollection, this method should return an empty Collection. Note
that it is not specified exactly what implementation of a Collection
is returned (that's up to you), just that whatever is returned
implements the Collection interface.
| getTodos |
public Collection getTodos();
getNotes() returns a Collection that holds all the
PIMTodo items currently in the PIMCollection. If there are no PIMTodo items
in the PIMCollection, this method should return an empty Collection. Note
that it is not specified exactly what implementation of a Collection
is returned (that's up to you), just that whatever is returned
implements the Collection interface.
| getAppointments |
public Collection getAppointments();
getAppointments() returns a Collection that holds all
the PIMAppointment items currently in the PIMCollection. If there are
no PIMAppointment items in the PIMCollection, this method should return
an empty Collection. Note that it is not specified exactly what
implementation of a Collection is returned (that's up to you), just
that whatever is returned implements the Collection interface.
| getContacts |
public Collection getContact();
getContacts() returns a Collection that holds all the
PIMContact items currently in the PIMCollection. If there are no
PIMContact items in the PIMCollection, this method should return an empty
Collection. Note that it is not specified exactly what implementation
of a Collection is returned (that's up to you), just that whatever is
returned implements the Collection interface.
| getItemsForDate |
public Collection getItemsForDate(Date d);
getItemsForDate returns a Collection that holds all the
PIMENtities in the PIMCollection that have a date that matches the
date d. If there are no items that match the date,
this method should return an empty
Collection. Note that it is not specified exactly what implementation
of a Collection is returned (that's up to you), just that whatever is
returned implements the Collection interface.
Note: It is expected that all PIMEntities in the returned collection implement the interface you created during HW3. (There should only be PIMTodo and PIMAppointment items, since notes and contacts are not associated with dates).
We will test your PIMCollection program using your other classes (everything from HW3). Although your PIMCollection class should not depend on any of your other classes (except for possibly the name of the "dateable" interface you created), we will use your classes when testing a PIMCollection, so make sure you include them in your submission. Feel free to make any changes you want to your HW3 classes for this assignment.
You do not need to provide us with a main() that tests your PIMCollection class, but feel free to do so if you want. We can write our own main that creates a PIMCollection object and puts some PIMENtities into it to test it. (Although since we don't have standard interfaces to PIMNote, PIMTodo, etc we won't be putting anythings except priorities in the PIMNotes, PIMTodos, PIMAppointments, etc).
Your PIMCollection class must be a Collection! All methods defined of any Collection object must be supported. Although this sounds difficult, all you need to do is to extend an existing Collection class (like an ArrayList or HashSet). Use whatever makes sense to you as your base class, but it isn't necessary (or wise) to implement the entire Collection interface from scratch (just inherit it!).
| How to submit |
Submission of your homework is via email, the general idea is to send an email message with your files as attachments. There is an automated email submission system that will respond to your submission right away, so you will have a record that we got your files. For HW4 you should submit your .java files for PIMCollection and cal, and the files you submitted for HW3.
All projects must be submitted via email to javaprog-submit@cs.rpi.edu.
The subject line of the submission message should contain a single
number '4' indicating the HW number. The body of your message should
include your full name (and anything else you want to tell us). Make
sure your email message includes your full name, we can't record your
grade unless we know your name (and the email address
joe222@yahoo.com doesn't mean anything to us!).
Don't send compiled code (class files)!
You can expect a return email indicating receipt of your project submission immediately. This receipt will include a list of all the files that were successfully extracted by the submission script - please look over the receipt carefully to make sure your submission worked.
Multiple Submissions: You can resubmit up to 10 times for each project, we will always grade the last submission received unless you tell us otherwise.