Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. a. In Chapter 3, you designed a Card class. The class holds fields that contain a Cards value and suit. Currently, the suit is

1. a. In Chapter 3, you designed a Card class. The class holds fields that contain a Cards 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 Cards rank based on its value. Within the Card class setValue() method, besides setting the numeric value, also set the string rank value as follows.

Then...

3. a. In Chapter 7, you modified a previously created Card class so that each Card would hold the name of a suit (Spades, Hearts, Diamonds, or Clubs) as well as a value (Ace, King, Queen, Jack, or a number value). Now, create an array of 52 Card objects, assigning a different value to each Card, and display each Card. Save the application as FullDeck.java.

Original Code:

public class Card

{

private char suit;

private int value;

public Card()

{

suit=' ';

value=0;

}

public Card(char suit, int value)

{

this.suit=suit;

this.value=value;

}

public void setSuit(char suit)

{

this.suit=suit;

}

public char getSuit()

{

return suit;

}

public void setValue(int value)

{

this.value=value;

}

public int getValue()

{

return value;

}

public String toString()

{

return value + " of " + suit;

}

}

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

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions

Question

Does it clearly identify what you have done and accomplished?

Answered: 1 week ago

Question

Discuss the different types of leadership

Answered: 1 week ago

Question

Write a note on Organisation manuals

Answered: 1 week ago

Question

Define Scientific Management

Answered: 1 week ago

Question

Explain budgetary Control

Answered: 1 week ago