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 their face values. 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 you play cards with a computer.  For this project, we are going to focus on one suit of the deck of cards. There are only 13 cards (value: 2, ... to 10, Jack, Queen, King and Ace) in a suit. To play: (a). You first pick a suit at random from the four suits (club, diamond, heart and spade), and display the suit.  (b) Then you randomly draw a card from the suit, and let computer draw a card from the same suit at random as well. (Note after a card is taken it cannot be withdrawn again).  (c). display the two cards and your program compares the values of the two card to determine who wins (there cannot be a tie in this project). Note that with a suit, you can only play at most 6 games, then you have to shuffle the cards (reset the cards).  (d) ask a user if he/she wants to play again. If a user chooses to play again, go back to (a). otherwise stop the game and display total number of games played and numbers you win and computer wins respectively

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question


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 their face values. 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 you play cards with a computer.  For this project, we are going to focus on one suit of the deck of cards. There are only 13 cards (value: 2, ... to 10, Jack, Queen, King and Ace) in a suit. To play:
(a). You first pick a suit at random from the four suits (club, diamond, heart and spade), and display the suit. 
(b) Then you randomly draw a card from the suit, and let computer draw a card from the same suit at random as well. (Note after a card is taken it cannot be withdrawn again). 
(c). display the two cards and your program compares the values of the two card to determine who wins (there cannot be a tie in this project). Note that with a suit, you can only play at most 6 games, then you have to shuffle the cards (reset the cards). 
(d) ask a user if he/she wants to play again. If a user chooses to play again, go back to (a). otherwise stop the game and display total number of games played and numbers you win and computer wins respectively.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY