COP 2800 (Java Programming I) Homework Assignment #6


Due: by the start of class on the date shown on the syllabus


Answer the following questions as briefly (but completely) as possible:

  1. How do you create a Date for the current time?  How do you display the current time?
  2. Suppose the ArrayList list contains duplicate elements.  Does the following code correctly remove all elements from list?  If not, correct the code.
    for ( int i = 0; i < list.size(); i++ )
       list.remove( element );
  3. How do you create an object of the java.util.Calendar class, that represents the current moment in time?
  4. For a Calendar object c, how do you get its year, month, date, hour, minute, and second?
  5. Using the java.time API, how can you add one month to a LocalDate object?  How can you create a LocalDate object that represents the last Friday of the current month?

To be turned in:

Email your homework assignment, by copy-and-paste (no attachments please), to (homework submission).  If possible use the “text” and not the “HTML” mode of your email program.  Please use the subject similar to “Java Programming I Homework Assignment #6 Submission”, so I can tell which emails are submitted homework assignments.

Homework assignments will not be returned.  Please do not send as attachments.  Refer to the Homework and the Submitting Assignments sections of your syllabus for more information.

Confused?  Send questions about the homework assignment to (homework questions).  Please use a subject similar to “Java Programming I Homework Assignment #6 Questions” so I can tell which emails are questions about assignment quiz (and not submissions).