Starting from:

$30

ECE39595-Homework 4 Solved


Use the code in directory userid.  I have given you the skeletons for all classes that you need to implement.  Comments in the code provide suggestions as to how to implement the functions.   You should implement all necessary constructors.  The code in HW4.java should not be changed, and this code should be used as your main function.

Comparable is a base class that allows two objects that derive from Comparable to be compared as greater than, less than or equal to another Comparable object.  IntArray and Point are two classes that derive from Comparable, and therefore can be compared.  They also implement hashCode( ) and equal( ).  The constraints on these methods are given in the comments.  Finally, main uses the functionality in Comparable to sort arrays of Comparable objects and runs some tests on your hashCode( ) and equals( ) functions.

More products