logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jason RoyComputer science
(5/5)

598 Answers

Hire Me
expert
Henry SimmonsEnglish
(5/5)

669 Answers

Hire Me
expert
Abhilekh Nath DasComputer science
(/5)

638 Answers

Hire Me
expert
Manal ChiguerrNursing
(5/5)

979 Answers

Hire Me
Java Programming

how to implement a Monte Carlo simulation using die rolls the concepts covered in this lab are for loops, file input, and randomness.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Purpose: The lab this week will focus on learning how to implement a Monte Carlo simulation using die rolls. The concepts covered in this lab are for loops, file input, and randomness.

 

Task: This program will need all classes in the io package as well as the Random class. You will use the PrintWriter class to save the results of this lab to a text file. Use the Random class to simulate rolling a die. This means randomly picking a number from 1 to 6. Perform this action 10000 times and maintain a count of how often you roll each side of the die. When printing the results to a file, including both the number of rolls as well as the percentage of rolls out of the 10000 total rolls. As a small bonus, provide a short write up explaining the meaning behind the results of this simulation.

 

Bonus Task: As a much larger bonus, instead of simulating rolling a die, refer to the following scenario:

 

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

 

You will simulate this game show 10000 times and keep a count of how often you win before making the switch and how often you win after making the switch. This means that your program must handle the process of selecting a prize door, having a contestant pick a door, revealing a door to the contestant, and switching the contestant’s choice after the reveal. The results printed to the file should include both the counts and percentages for each type of win. 

Criteria: Program correctness includes proper and accurate results from the simulation as well as correctly printing the results to a file. Program correctness is worth 50 points. The simulation process requires properly using loops and the Random class. This process is worth 45 points. Descriptive comments explaining the overall program and key elements are 5 points. The write up is worth 10 bonus points. Implementing a simulation of the game show is worth 50 bonus points.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme