Homework 1

You submit a draft on Wednesday and a final version on Saturday.

A. Complete this class.

Visit this link and paste in your class. Save the report and attach it with your draft and final homeworks. Also submit your Java file.

The draft should compile and modify the array in some way.

B. Submit a program Homework1ATester that tests the Homework1A program. Make an array of some objects that implement the Comparable interface type. Invoke the method. Print out the array (using Arrays.toString) afterwards, and also print out the output that was expected. The output should look like

(Actual result)
Expected: (Expected result)

Visit this link and paste in your class. Save the report and attach it with your draft and final homeworks. Also submit your Java file.

The draft should compile and print something of the form

xxx
Expected: yyy

C. Make the Point class from Homework 0 implement the Comparable interface. To compare two points, first compare their x-coordinates. If they differ, the point with the smaller x is deemed the smaller. If the x-coordinates are the same, compare the y-coordinates. The point with the smaller y-coordinate is then deemed the smaller. If the x- and y-coordinates are the same, the points are equal (duh).

Here is a tester.

Visit this link and paste in your class. Save the report and attach it with your draft and final homeworks. Also submit your Java file.

The draft should compile with the tester.