Question: Design your own Statck class and Queue class. You may choose to use either an Array or an ArrayList to store your stack/Queue data elements.

Design your own Statck class and Queue class. You may choose to use either an Array or an ArrayList to store your stack/Queue data elements.

1. Create your own Stack.java and Queue.java files.

2. Use either an Array or ArrayList to store the data elements.

3. Implement the common stack methods: push(), pop(), peek(), size(), isEmpty().

4. Implement the common queue methods: offer(), poll(), peek(), size(), isEmpty().

5 Please throw an exception when you have to pop/poll out of an empty stack/queue.

6. (Optional) Expand your e-commerce application from your earlier homework solutions to include either a stack or queue to store/process the e-commence items in design.

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!