Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

plz help me solve this! thank you!! Java book chapter 7. GameZone 1 In Chapter 3. you designed a Card class. The class holds fields

image text in transcribedplz help me solve this! thank you!! Java book chapter 7. GameZone 1

In Chapter 3. you designed a Card class. The class holds fields that contain a Card's value and suit. Currently. the suit is represented by a single character (s, h. d. or c). Modify the class so that the suit is a string (Spades "Hearts", Diamonds' or Clubs") Also, add a new field to the class to hold the string representation of a Card's rank based on its value. Within the Card class setValue() method, besides setting the numeric value, also set the string rank e as follows. 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-23 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

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_2

Step: 3

blur-text-image_3

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

Students also viewed these Databases questions

Question

What is distributed data processing?

Answered: 1 week ago

Question

2. How were various roles filled?

Answered: 1 week ago