purpose of this application is to create a multi-threaded application with one thread being a producer of playing cards and another thread being a consumer of playing cards. the application will run with the welcome to war greeting : here is an example of what it should look like . The buffer will be based on the SynchronizedBuffer but will store a Card instead of an int. The producer will produce a playing card having a random value of either 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, or Ace. The producer will put that randomly created card in the buffer. Afterward, the producer will sleep randomly between 1-4 seconds before producing another card. The consumer will get 2 cards from the buffer. Once the consumer has 2 cards, it will use them to simulate the card game WAR. The consumer will compare the cards and print the winner. Afterward, the consumer will sleep randomly between 1-4 seconds before consuming cards and simulating the game again. Both producer and consumer will run forever. This means the output of the game will never end – the game will play forever. run: Welcome to WAR Producer has started running Consumer has started running Producer produced 5 Buffer empty. Consumer waits. Producer produced 2 PLAY GAME Card 1 is "5", Card 2 is "2". Winner is Card 1 Buffer empty. Consumer waits. Producer produced 3 Buffer empty. Consumer waits. Producer produced 4 PLAY GAME Card 1 is "3", Card 2 is "4". Winner is Card 2 Buffer empty. Consumer waits. Producer produced 5 MORE VIDEOS pty. Consumer waits.. run: Welcome to WAR Producer has started running Consumer has started running Producer produced 5 Buffer empty. Consumer waits. Producer produced 2 PLAY GAME Card 1 is "5", Card 2 is "2". Winner is Card 1 Buffer empty. Consumer waits. Producer produced 3 Buffer empty. Consumer waits. Producer produced 4 PLAY GAME Card 1 is "3", Card 2 is "4". Winner is Card 2 Buffer empty. Consumer waits. Producer produced 5 MORE VIDEOS pty. Consumer waits..


Are there any questions left?
New questions in the section Engineering
Sign up for the IQClass
Answers from experts with no ads!
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Made with love
This website uses cookies to make IQClass work for you. By using this site, you agree to our cookie policy

Pleased to see you again

IQClass unlocks the learning potential of every child
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign in
Recover lost password
Or log in with

Create an account

IQClass unlocks the learning potential of every child
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign Up
Or sign up with
By signing up, you agree to the Terms of use and Privacy policy.
Looking for an answer to a question you need help with?
you have баллов