Question

$3.00 Java Help with Copy Constructor and Equals Method.

Asked by :
howithink
howithink Not confirmed
Rating :No Rating
Questions Asked: 2
Tutorials Posted: 0
 
 
Q:
This relates to the SimpleSet code that we discussed in class. Please add: 1) a copy constructor and 2) and equals method. The signatures would be:

public SimpleSet(SimpleSet sourceSet) { ... }

public boolean equals(SimpleSet otherSet) { ... }

The copy constructor should create an exact duplicate of the sourceSet argument. The equals() method should return true only if all of the real elements (not the -1 placeholders) appears in both sets - the order of the values doesn't matter.

Please provide a sample test in the SimpleSetTest.java file provided in the attachment. Also the above code needs to go at the end of SimpleSet.java file provided in the attachment.

thank you
 
attachement
 

Available Tutorials to this Question
 
$5.00
Added the copy constructor and equal method
  • This tutorial hasn't been purchased yet.
  • Posted on May 31, 2009 at 3:13:01PM
Posted by :
max_max
max_max Not confirmed
Rating (36):B+
Questions Asked: 0
Tutorials Posted: 189,
Earned: $267.87
 
A:
Preview: ... ttache ...

The full tutorial is about 5 words long plus attachments.

attachmentlogo

Attachments:
SimpleSet.java (7K) (Preview)
SimpleSetTest.java (0K) (Preview)