b. In Chapter 5, you created a War Card game that randomly selects two cards (on
ID: 3732892 • Letter: B
Question
b. In Chapter 5, you created a War Card game that randomly selects two cards (one for the player and one for the computer) and declares a winner (or a tie). Modify the game to set each Card's suit as the appropriate string, then execute the game using the newly modified Card class. Figure 7-18 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. Command Prompt - O X C:Java>java War2 My card is the 10 of Diamonds Your card is the Queen of Hearts You win C:Java>java War2 My card is the Ace of Diamonds Your card is the 7 of clubs You win C:Java>java War2 My card is the 10 of Hearts Your card is the 10 of Spades It's a tie C:Java>java War2 My card is the 9 of Diamonds Your card is the 3 of Diamonds I win C:Java> Figure 7-18 Four typical executions of the War2 gameExplanation / Answer
Here is complete code of this card game. Since I don't have your Existing card class I have created it
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.