Question
Programming Project - Stacks & Queues Part 1 - Implementing a Stack and a Queue 1) Download Project6Starter.zip and copy the files into an Eclipse
Programming Project - Stacks & Queues
Part 1 - Implementing a Stack and a Queue
1) Download Project6Starter.zip and copy the files into an Eclipse project. Note that you should not modify the package structure of the project and the LInkedStack and LinkedQueue classes must remain in the jsjf package.
2) Complete the implementation of the LinkedStack & LinkedQueue classes in the jsjf package.
3) Your code should work with the provided sample test driver without modification. You should make sure your code is correct by performing additional tests - the test driver may not cover all the cases that will be tested when you submit your code.
4) Create a driver class called Project6.java that demonstrates that all LinkedStack & LinkedQueue methods work correctly.
Part 2 - Stack & Queue Application - Card game
1) Write a class called StackHand which implements the HandOfCards interface using the LinkedStack class from the jsjf package. Include the following methods:
play() which removes a card from the hand and returns the card
size() which returns the number of cards in the hand
2) In a separate driver class called WarGame, deal 2 StackHands of cards. The hands should have the same number of cards.
A. Play a game of war with the two hands. Deal the top card. The player with the highest value card gets a point.
B. When the hands are empty, print the score for each player.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started