Using a Java program solve the following problem using arrays: Past A: Coupon collector is a classic statistic problem with many practical applications. The problem is to pick objects from a set of objects repeatedly and determine how many picks are needed for all the objects to be picked at least once. A variation of the problem is to pick cards from a shuffled deck of 52 cards repeatedly and find out how many picks are needed before you see one of each suit. Assume a picked card is placed back in the deck before picking another. Write a program to simulate the number of picks needed to get total of four cards from each different suit and display the four cards picked (it is possible that a card may be picked twice). Here is a sample run of the program: Queen of Spades 5 of Clubs Queen of Hearts 4 of Diamonds Number of picks: 12 Sample run explanation: As you see in the above run, 12 picks are made to get the four cards from different suits. The other 8 picks (12-4-8) were from the same previously picked suits, so they are not printed. So we continue picking a card until we see at least one card from each of the for suits. Note: The card pick is with replacement, meaning that when you pick a card from the deck of 52 card, you put it back in the deck. There is chance to see the previously selected card again. Part B: Put part A in a for loop and repeat it 10,000 times and report the average number of total picks we should have to see 4 cards from different suits.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question
Using a Java program solve the following problem using arrays:
Past A: Coupon collector is a classic statistic problem with many practical applications.
The problem is to pick objects from a set of objects repeatedly and determine how
many picks are needed for all the objects to be picked at least once. A variation of the
problem is to pick cards from a shuffled deck of 52 cards repeatedly and find out how
many picks are needed before you see one of each suit. Assume a picked card is placed
back in the deck before picking another. Write a program to simulate the number of
picks needed to get total of four cards from each different suit and display the four
cards picked (it is possible that a card may be picked twice). Here is a sample run of the
program:
Queen of Spades
5 of Clubs
Queen of Hearts
4 of Diamonds
Number of picks: 12
Sample run explanation: As you see in the above run, 12 picks are made to get
the four cards from different suits. The other 8 picks (12-4-8) were from the same
previously picked suits, so they are not printed. So we continue picking a card
until we see at least one card from each of the for suits.
Note: The card pick is with replacement, meaning that when you pick a card from the
deck of 52 card, you put it back in the deck. There is chance to see the previously
selected card again.
Part B: Put part A in a for loop and repeat it 10,000 times and report the average
number of total picks we should have to see 4 cards from different suits.
Transcribed Image Text:Using a Java program solve the following problem using arrays: Past A: Coupon collector is a classic statistic problem with many practical applications. The problem is to pick objects from a set of objects repeatedly and determine how many picks are needed for all the objects to be picked at least once. A variation of the problem is to pick cards from a shuffled deck of 52 cards repeatedly and find out how many picks are needed before you see one of each suit. Assume a picked card is placed back in the deck before picking another. Write a program to simulate the number of picks needed to get total of four cards from each different suit and display the four cards picked (it is possible that a card may be picked twice). Here is a sample run of the program: Queen of Spades 5 of Clubs Queen of Hearts 4 of Diamonds Number of picks: 12 Sample run explanation: As you see in the above run, 12 picks are made to get the four cards from different suits. The other 8 picks (12-4-8) were from the same previously picked suits, so they are not printed. So we continue picking a card until we see at least one card from each of the for suits. Note: The card pick is with replacement, meaning that when you pick a card from the deck of 52 card, you put it back in the deck. There is chance to see the previously selected card again. Part B: Put part A in a for loop and repeat it 10,000 times and report the average number of total picks we should have to see 4 cards from different suits.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr