Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hey can u look this up in your cheggs account for me public Card[] deal(int numCards)-- This method will remove the specified number of cards
Hey can u look this up in your cheggs account for me
public Card[] deal(int numCards)-- This method will remove the specified number of cards from the top of the deck and return them as an array. For example, if the parameter is 4, then the first four cards in the deck will be returned as an array of size 4. Important: The cards will be removed from the front of the "cards" array, not the back.
Hint: The "cards" array will need to be resized. Here is the idea:
Make a new array (call it "smaller") that is the same size as the current deck of cards minus the number of cards being dealt.
Copy the cards that are not being dealt from the original array into the new one.
Assign the instance variable "cards" so that it refers to the new array.
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