hello there i have trouble understanding this assignment so can any one explain it to me.
Joe Optimist makes the following claim “If we draw three cards randomly from a standard 52-card deck, we have a greater than 10% chance of having them be of consecutive face values”. (9 7 8) (Q 10 J) (A 3 2) (Q K A) are all considered consecutive face values, but (3 4 6) and (J Q A) do not, independently of the card
suits. The draws are always made from a full deck, i.e., a card is returned to the deck before the next one is taken.
One way to verify this claim is to perform a Monte Carlo simulation in which we randomly draw 3 cards from a deck and check whether the cards have 3 consecutive values. If we repeat this experiment a sufficiently large number of times and collect statistics on the number of times we obtain 3 consecutive cards, the ratio of that number to the total number of trials gives us an estimate of the probability we seek.
Write a program Consecutive.jav a to evaluate whether the claim is true or not. The program should take a command line integer parameter N indicating the number of trials to perform and return the probability of having a 3-draw consisting of consecutive face values. Run the program with N = 1,000, N = 10,000, N=100,000 and comment on the accuracy of your results. Hints: The face values of cards can be mapped to integers between 1 and 13. Write a method that returns a random number in that range, and use it to draw 3 cards. Write another method that checks whether 3 cards have consecutive face values.
Joe Optimist makes the following claim “If we draw three cards randomly from a standard 52-card deck, we have a greater than 10% chance of having them be of consecutive face values”. (9 7 8) (Q 10 J) (A 3 2) (Q K A) are all considered consecutive face values, but (3 4 6) and (J Q A) do not, independently of the card
suits. The draws are always made from a full deck, i.e., a card is returned to the deck before the next one is taken.
One way to verify this claim is to perform a Monte Carlo simulation in which we randomly draw 3 cards from a deck and check whether the cards have 3 consecutive values. If we repeat this experiment a sufficiently large number of times and collect statistics on the number of times we obtain 3 consecutive cards, the ratio of that number to the total number of trials gives us an estimate of the probability we seek.
Write a program Consecutive.jav a to evaluate whether the claim is true or not. The program should take a command line integer parameter N indicating the number of trials to perform and return the probability of having a 3-draw consisting of consecutive face values. Run the program with N = 1,000, N = 10,000, N=100,000 and comment on the accuracy of your results. Hints: The face values of cards can be mapped to integers between 1 and 13. Write a method that returns a random number in that range, and use it to draw 3 cards. Write another method that checks whether 3 cards have consecutive face values.
Comment