Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programs using Dice: 1. Box Cars: roll two 6 sided Dice 1000 times.counting the number of box cars (two sites that occur. This program should

image text in transcribed
Programs using Dice: 1. Box Cars: roll two 6 sided Dice 1000 times.counting the number of box cars (two sites that occur. This program should use Die ciass. You should also include a block comment comparing the experimental probability with theoretical probability to getting box cars. How many time do you need to roll these dice in order for experimental probability to converge to theoretical probability? 2. Dice Probability: Write program to output following probabilities Create 5, 6 sided Dices and output the total number of times event occurs and the probability of sum of all the rolls for the following results: NUM ROLLS Sum of 15 Sum between 5-10 Prahat Sum of 20 Probabil Sumbetween 15-35 100 10000 10000 Count Count Count Count 3. Pig Game: Design and implement a class called Pairotice, composed of two Die objects. Using the Pairoftice class, Design and implement a game called Pig. In this game, the user competes against the computer. On each turn, the current player rolls a pair of dice and accumulates points. The goal is to reach 100 points before your opponent does. If on any turn, the player rolls a 1. all points accumulated for that round are forfeited and control of the dice moves to the other player. If the player rollstwo is in one turn, the player loses all points accumulated thus far in the game and loses control of the dice. The player may voluntarily turn over the dice after each roll Therefore the player must decide to either roll again (be a pig) and risk losing points, or relinquish control of the dice, possibly allowing the other player to win. Implement the computer player such that it always relinquishes the dice after accumulating 20 or more points in any given round. 4. Dice Graph: In order to do this program you must use Pairofice dass. Prompt user to enter how many times they will like to roll a pair of 6-sided dice. Then find number of time sum of roll of pair of dice is 2.3. ... 12. Finally draw a line graph-representing the outcome of this experiment. 5. Craps: Extra Credit 6. Make your own game: Using Die class, design and implement your own version of the game of Pig In order to do this you must decide on the following a Number of Dice to be used b. Number of sides on each dice. All the dice used for the game must have same number of sides. Criterion for when does computer decided to stop rolling and turns over the Dice. d Criterion for snake eyes / half snakes eyes / or anything else you can come up with like: doubles or sum to be a certain number. e Criterion for Winning If possible try to predict probability of winning. Try to keep probability of user and computer winning 50-50. & You need to submit a complete written description of the game. Rules on how to play game and determining a winner. Design with all the conditions and criterions completely and dearly explained. h. You must then implement this game using eclipse. Looking forward to play your version of Pig Game. Hope you have fun designing this game

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions