Mighty Casey plays centerfield for the Toledo Mudhens and has the following lifetime hitting percentages: See image.

The above is called a probability distribution. A probability distribution is used in predicting the likelihood of an event occurring. See the following explanation of probability distributions using the example of flipping a coin at: http://stattrek.com/Lesson2/ProbabilityDistribution.aspx. Notice the distribution adds up to 100%.

Write a program to simulate a large number of times at bat (1000 or more) for Mighty Casey counting the number of outs, walks, singles, etc. to predict Mighty Casey’s batting average for next season and slugging percentage. This means you have to generate a random number (hint: between 1 and 100 and see PP notes for random number generation formulas) and based upon the value (i.e. probability) will determine if Mighty Casey gets a hit or an out. If it is a hit, then your program needs to determine what type of hit was based upon the probabilities given in the table above.

Use the formulas below to calculate the batting average and slugging percentage of Mighty Casey.

batting average = number of hits / (number of times at bat – number of walks)
slugging percentage = (number of singles + number of doubles * 2 + number of triples * 3 + number of homeruns * 4) /(number of times at bat – number of walks)
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.