Question: Implement a stack data structure using arrays, which can hold *any* primitive data type values AND *any* type of objects. Your stack should have the

Implement a stack data structure using arrays, which can hold *any* primitive data type values AND *any* type of objects.

Your stack should have the same methods with the one in slides; push, pop, top.

Also, it should have one default constructor, and one with a single parameter.

Implement your stack using two approaches discussed in class:

1. MyStackPolymorphic.java using polymorpism

2. MyStackGeneric.java using Generics

3. Both version should throw an exception (MyStackEmptyException) when pop() is called if the stack is empty

4. Implement a single driver (MyStackDriver.java) to test BOTH data structures

5. Submit MyStackPolymorphic.java, MyStackGeneric.java, MyStackDriver.java and a screenshot of your test as a zip file.

Anyone have any idea how this works?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!