Java Programming Spring 2003 Homework #4 FAQ

Homework #4 FAQ

Question:

Can you give us some sample test code for PIMCollection?

Answer:

OK. There is some sample code available: PIMCollection test code

You should also consider using a PIMCollection object as a Collection, for example you could modify the ListPrinting program to use a PIMCollection instead of an ArrayList (it should work, since ListPrinting uses only Collection methods).

   
Question:

Do we need to use JavaDoc style comments in our code, and if so how can we make sure they are done correctly?

Answer:

Yes, you need to use JavaDoc style comments in your code (for everything you submit for the remainder of this class)!

To test your comments, just run javadoc and look at the HTML produced.

   
Question:

If we didn't use a Date object for storing date information in HW3, do we need to change our code for HW4 ?

Answer:

No, but you must be able to look up dates for the getItemsForDate() method. Don't worry about using deprecated methods (if you had already done so), that's fine.

   
Question:

In the project description you show a sample java cal 4 2005 that then shows the calendar for 2025

Answer:

This was a typo (now fixed).

   
Question:

My PIM items use a String for representing dates, so can I change the prototype of getItemsForDate to this:

 public Collection getItemsForDate(String d);

Answer:

No. You need to convert the Date object to a string if that is what you want to use internally.

But, keep in mind the following: we can't actually test this function, since we have no way of knowing how to create a PIMEntity that has a specific date! We can (and will) call getItemsForDate(Date d), but all we expect is an empty collection back... If you don't use the correct parameter type we won't be able to call the method.

Feel free to do something like this (which to work, would require that users enter date strings in a specific format):

public getItemsForDate(String s) is left as you already have it. Now just add this method:

public Collection getItemsForDate( Date d) {
    return( getItemsForDate( d.toString()); 
}