1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Naya [18.7K]
4 years ago
7

The programming projects of Chapter 4 discussed a Card class that represents a standard playing card. Create a class called Deck

OfCards that stores 52 objects of the Card class. Include methods to shuffle the deck, deal a card, and report the number of cards left in the deck. The shuffle method should assume a full deck. Create a driver class with a main method that deals each card from a shuffled deck, printing each card as it is dealt.

Computers and Technology
1 answer:
RideAnS [48]4 years ago
3 0

Answer:

Check the explanation

Explanation:

====================Card.java====================

package card_game;

public class Card {

public final static int ACE = 1;

public final static int TWO = 2;

public final static int THREE = 3;

public final static int FOUR = 4;

public final static int FIVE = 5;

public final static int SIX = 6;

public final static int SEVEN = 7;

public final static int EIGHT = 8;

public final static int NINE = 9;

public final static int TEN = 10;

public final static int JACK = 11;

public final static int QUEEN = 12;

public final static int KING = 13;

public final static int CLUBS = 1;

public final static int DIAMONDS = 2;

public final static int HEARTS = 3;

public final static int SPADES = 4;

private final static int NUM_FACES = 13;

private final static int NUM_SUITS = 4;

private int face, suit;

private String faceName, suitName;

// -----------------------------------------------------------------

// Creates a random card.

// -----------------------------------------------------------------

public Card() {

face = (int) (Math.random() * NUM_FACES) + 1;

setFaceName();

suit = (int) (Math.random() * NUM_SUITS) + 1;

setSuitName();

}

// -----------------------------------------------------------------

// Creates a card of the specified suit and face value.

// -----------------------------------------------------------------

public Card(int faceValue, int suitValue) {

face = faceValue;

setFaceName();

suit = suitValue;

setSuitName();

}

// -----------------------------------------------------------------

// Sets the string representation of the face using its stored

// numeric value.

// -----------------------------------------------------------------

private void setFaceName() {

switch (face) {

case ACE:

faceName = "Ace";

break;

case TWO:

faceName = "Two";

break;

case THREE:

faceName = "Three";

break;

case FOUR:

faceName = "Four";

break;

case FIVE:

faceName = "Five";

break;

case SIX:

faceName = "Six";

break;

case SEVEN:

faceName = "Seven";

break;

case EIGHT:

faceName = "Eight";

break;

case NINE:

faceName = "Nine";

break;

case TEN:

faceName = "Ten";

break;

case JACK:

faceName = "Jack";

break;

case QUEEN:

faceName = "Queen";

break;

case KING:

faceName = "King";

break;

}

}

// -----------------------------------------------------------------

// Sets the string representation of the suit using its stored

// numeric value.

// -----------------------------------------------------------------

private void setSuitName() {

switch (suit) {

case CLUBS:

suitName = "Clubs";

break;

case DIAMONDS:

suitName = "Diamonds";

break;

case HEARTS:

suitName = "Hearts";

break;

case SPADES:

suitName = "Spades";

break;

}

}

// -----------------------------------------------------------------

// Determines if this card is higher than the parameter. The

// second parameter determines if aces should be considered high

// (beats a King) or low (lowest of all faces). Uses the suit

// if both cards have the same face.

// -----------------------------------------------------------------

public boolean isHigherThan(Card card2, boolean aceHigh) {

boolean result = false;

if (face == card2.getFace()) {

if (suit > card2.getSuit())

result = true;

}

else {

if (aceHigh && face == ACE)

result = true;

else if (face > card2.getFace())

result = true;

}

}

=========================Sample output=======================

You might be interested in
How can the IOSP model help us to design an app that solves a problem?
docker41 [41]

Answer:

Definition. IOSP. Input Output Server Processor. IOSP. Integrative and Organ Systems Pharmacology (course; various locations)

Explanation:

6 0
3 years ago
Which of the following hardware developments allow objects to connect to a network and share data with any other application, se
Norma-Jean [14]
Server and device both are useful to object to connect to a network and share data with any other application.
5 0
3 years ago
which term describes the layer of software that resides between the virtual operating system and the physical hardware it runs o
sasho [114]

Answer:

hypervisor

Explanation:

becauseis a thin layer of software that resides between the virtual operating system(s) and the hardware. The physical host is the actual hardware that the hypervisor software runs on.

8 0
3 years ago
Which 10 gigabit standard uses mmf cabling for distances up to 300 meters and is often used for sonet campus networks?
WITCHER [35]

I guess the correct answer is 10GBase-SW

10GBASЕ-SW mеdia typеs arе dеsignеd fοr usе οvеr shοrt wavеlеngth (850 nm) multimοdе fibеr (MMF). Thе dеsign gοal οf thеsе mеdia typеs is frοm 2 mеtеrs tο 300 mеtеrs οf fibеr distancе, dеpеnding οn thе typе and quality οf thе multimοdе fibеr. Lοngеr distancеs arе pοssiblе dеpеnding οn thе qualitiеs οf thе fibеr οptic cablе usеd. Thе 10GBASЕ-SW mеdia typе is dеsignеd tο cοnnеct tο SΟNЕT еquipmеnt, which is typically usеd tο prοvidе lοng distancе data cοmmunicatiοns.

5 0
3 years ago
Find the error in the following pseudocode.
AnnZ [28]

Answer:

there is a song about a hundred digits of pieeee

Explanation:

4 0
3 years ago
Other questions:
  • Let’s say you are given the task of retouching a famous model’s photograph. To what extent will you retouch the image? In your o
    12·2 answers
  • Namespaces cannot have namespaces as members.<br><br> True<br><br> False
    7·1 answer
  • Which process refers to starting up a computer?
    13·2 answers
  • Difference between softcopy and hardcopy​
    8·2 answers
  • What is the name of the symbol that is used to classify and categorize information?​
    10·2 answers
  • What is a system unit
    7·1 answer
  • What is a resume?A collection of all your professional and artistic works.A letter which explains why you want a particular job.
    6·1 answer
  • What is an example of an absolute cell reference​
    8·1 answer
  • PYTHON:
    11·1 answer
  • If you are inviting more than one person to a meeting, you can use a(n) _____ to separate the email addresses.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!