Homework 1
You are not asked to submit this assignment for grading, but you should do it since it will help you prepare for exams.
Most of these exercises are from Practice-It or CodeStepByStep. You may need to create a (free) account in order to access the exercies on those sites. When creating an account, it may take up to two or threee hours to receive the verification email from them. (If it takes longer than three hours, let me know.) Once you have an account, when you submit code, the site will judge it for correctness.
-
On arrays, here's an exercise that may help you prepare for a future assignment: rotateRight on Practice-It.
-
The following exercises cover most of the ArrayList methods you should already know. They also offer practice with tracing code to determine what gets printed, which is the basis of some exam questions in this course.
-
On Comparable:
-
ComparablePoint on CodeStepByStep; ignore what it says in parentheses about a section handout)
- If you can't access the exercise, please try this link.
-
ComparableTimespan on CodeStepByStep (disregard the mention of Chapter 8; the rest of the TimeSpan class is linked above the instructions)
- If you cannot access this exercise even after you create and verify an account, you can try modifiying your account to indicate that your school is CUNY Brooklyn College. But, if you wish, you may just skip this exercise.
-
ComparableCalendarDate on CodeStepByStep; ignore what it says in parentheses about a section handout)
- If you can't access the exercise, please try this link.
- BookData on Practice-It
-
On equals and hashCode: override the equals and hashCode methods for each of the classes in the above section (Point2D, TimeSpan, and CalendarDate).
-
On Comparator: