Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Phase 2 : The Deck and Hand Classes For your second test client, allow your Deck class to interact with your Hand class. Don't add
Phase : The Deck and Hand Classes
For your second test client, allow your Deck class to interact with your Hand class. Don't add anything to the two classes, but do everything in this phase from within your main client.
Ask the user interactively to select the number of players a number from to That's one question, one numeric answer, and no further userinteraction. Once you have a legal value, instantiate a singlepack Deck object without shuffling, deal a deck into that many Hand objects, dealing all cards until the deck is empty. Since the number of players chosen by the user may not divide evenly into the number of cards dealt into the various hands might differ, but only by at most, one. Display all the hands after the deal.
Reset the objects to their initial state, but this time shuffle the deck before a second deal same # of players
To be clear, dealing to hands means dealing a single card to each hand, until all hands have one card, then repeating to give all hands a second card, etc., until the cards are gone, and each hand has nearly the same number of cards. It does not mean dealing x cards to one hand, then x to the next hand, etc. This is very important.
You don't need any more classes than the ones we've already created, since there should not be that much to do in main
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