Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> > would u have any code for the following 4 questions > > > > Problem 6.2 Write an ADT function in Java that takes an array (possibly containing multiple occurances of particular elements) and returns an array with all duplicates of elements removed. When comparing array elements use the boolean equals(Object e) method that many ADTs in Java support. So, where one might have used (list[1]==list[2]) when comparing int array elements, one will use (list[1].equals(list[2])) when comparing Object array elements. This is to avoid comparing references (or addresses in memory) of objects when we mean to compare the value of objects. > > Problem 6.3 Write a class in Java that specifies an ADT to store an array of Objects. Besides constructors, it should have a toString() method and a removeDuplicates() method. Also write a tester program. > > Problem 6.4 Write a class in Java that specifies an ADT to store an array of Lab06C objects. Besides constructors, it should have a totalSiblings() method and a toString() method. The totalSiblings() method should return the total sum of the siblings of each person in the array. Also write a tester program. >
Replies: |
Sponsored Links
|