The Artima Developer Community
Sponsored Link

Legacy Design Forum
Designing with Interfaces

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:

java for postfix stack

Posted by kklin on July 17, 2001 at 11:25 AM

> would u have any code for the following 4 questions

>
> Problem 6.1 Write code for an array-implementation of the well-known stack operations push(e), pop(), and isEmpty(), such that they would support Objects rather than simply ints as given in lectures.

> 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.


> if u can could u please reply very soon






Replies:
  • fds s January 12, 2002 at 9:48 AM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us