Question
Hello, I would love to see someone's solution to this problem in JAVA . I have tried everything and consulted many sources, but I still
Hello, I would love to see someone's solution to this problem in JAVA.
I have tried everything and consulted many sources, but I still keep getting duplicates in my draw and I don't know why. I have tried many shuffle methods and still getting duplicates. So, it would be nice to see a start-to-finish solution on how to navigate this problem. Please, and thank you very much for the help.
QUESTION:
1.) Design and implement a class called Card that represents a standard playing card. Each card has a suit (Diamond, Club, Heart, Spades) and a face value (1 - 10, Jack, Queen, King). Hint. You can use integers to represent the suit and face values. 2.) Design and implement another class called Player. This Player class should have a method called "drawCards" which will draw 5 random cards. 3.) Your driver program (class with the main method) will create an instance of the Player class and call drawCards() on the instance. After the drawCards() is called, your driver will pass the player instance to the System.out.println() method; this will print the 5 cards the player has pulled. Here is what the main method in your driver program should look like: Player p = new Player(); p.drawCards(); System.out.println(p); The output for the println above will be something like (your cards will be different): 5 of Hearts 9 of Clubs Jack of Hearts 1 of Diamonds Jack of Diamonds 4.) Remember this is replicating one deck of cards, meaning you cannot draw the same card more than once. You should try to solve this problem without using a set.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started