Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the last assignment, you created a card class. Modify the card class so the setValue() method does not allow a cards value to be

In the last assignment, you created a card class. Modify the card class so the setValue() method does not allow a cards value to be less than 1 or higher than 13. If the argument to setValue() is out of range, assign 1 to the cards value.

You also created a PickTwoCards application that randomly selects two playing cards and displays their values. In that application, all card objects were arbitrarily assigned a suit represented by a single character, but they could have different values, and the player observed which of two card objects had the higher value. Now, modify the application so the suit and the value both are chosen randomly. Using two card objects play a very simple version of the card game War. Deal two cards one for the computer and one for the player and determine the higher card, then display a message indicating whether the cards are equal, the computer won, or the player won. (Playing cards are considered equal when they have the same value, no matter what the suit is). For this game, assume the Ace (value 1) is low. Make sure that the two cards dealt are not the same card. For example, a deck cannot contain more than one card representing the 2 of spades. If two cards are chosen to have the same value, change the suit for one of them. Save the application as War.java

Now modify the game using the newly modified card class so that when a tie is declared, that each player puts down 10 cards each and compares the 11th card to see if there is a clear winner. If there is a tie, repeat the process until there is a clear winner. The table below shows four typical executions. Recall that in this version of War, you assume

that the ace is the lowest-valued card. Save the game as War2.java.

So I expect a Card.java, War.java and War2.java file; Each working off the other. No need to reinvent the wheel! Lastly I expect, when WAR is called, to see all ten cards displayed.

I did the part 1 war.java and i just need help on part 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

4 What typifies the first and second waves of HRM?

Answered: 1 week ago