Answered step by step
Verified Expert Solution
Link Copied!

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

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

Students also viewed these Databases questions

Question

=+5 How does HRM relate to efforts to increase innovation?

Answered: 1 week ago