Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A deck of cards contains 52 cards with four suits: club, diamond, heart and spade ranging in values from 2, ... to 10, Jack, Queen,

A deck of cards contains 52 cards with four suits: club, diamond, heart and spade ranging in values from 2, ... to 10, Jack, Queen, King and Ace. Ace has the highest value in the same suit. Cards can be compared using the face value. A card with higher face value is bigger than a card with lower face value. If two cards have the same face value, then the suit determines the order. Club is smaller than diamond which is smaller than heart which is smaller than spade. For example: club 2 < diamond 2 < heart 2 < spade 2 if compared.

Write an interactive Java program that allows a user to randomly draw a card from a deck of cards, displays the card (value and suit) and then the program acts as a card dealer which randomly draws a card and displays the card. Your program then compares the two cards and displays the result: you win, or you loose, it is impossible to have a tie.

Use either four arrays or one two-dimensional array to store a deck of cards.

use a method to shuffle/reset the deck of cards which resets the deck of cards to 52 cards.

use a method that randomly draws a card and returns the card it draws. keep in mind, once a card is drawn from the deck, it cannot be drawn again.

Your program first displays a message telling the user the playing instructions, calls the method to shuffle/reset the deck of cards if user wants, calls the drawing method to draw a card, then compares two cards and finally displays the result.

After one play, your program asks user if he/she wants to continue playing or shuffle the cards and start the game with a new deck.

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

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions

Question

2 Novelty and unpredictability teach flexibility. Discuss.

Answered: 1 week ago

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago