Stack and Queue

Implement a generic stack and queue classes (StackWAS and QueueWAS, named to avoid confusion with the classes already defined in the JDK), using an internal array to store the elements.

Specific requirements include:
• Implement a driver class for the StackWAS class. There should be appropriate comments in the source code files.
• Use the menu based approach you defined in Week 1 to test your stack class.
• Implement a driver class for the QueueWAS class. There should be appropriate comments in the source code files.
• Use the menu based approach you defined in Week 1 to test your queue class.

Methods for StackWAS
• StackWAS (int) // constructor
• void push (T)
• T pop ()
• T peek ()
• boolean isEmpty()
• boolean isFull()
• String toString ()
Create a test report (stacktest.doc/docx/pdf/…) showing the correct behaviour of all the methods; include a description of the design; include screenshots of your running program.

Methods for QueueWAS
• QueueWAS(int) // constructor
• void enqueue (T)
• T dequeue ()
• T peek ()
• boolean isEmpty()
• boolean isFull()
• String toString ()
Create a test report (queuetest.doc/docx/pdf/…) showing the correct behaviour of all the methods; include a description of the design; include screenshots of your running program.

Deliverables:
– the Java source code files
– the test report files (stacktest.doc/docx/pdf/…, queuetest.doc/docx/pdf/…)

Please create an archive (zip/rar) with all the deliverables, name it as “Project1”+yourname, and submit using LEO under the Project 1 assignment.

×
New Download