Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following expression returns a random number between 1 and 6 inclusive, i.e., it simulates a die (singular of dice) roll. 1 Math.floor((Math.random() * 6)

The following expression returns a random number between 1 and 6 inclusive, i.e., it simulates a die (singular of dice) roll.

1

Math.floor((Math.random() * 6) + 1)

Use this expression to simulate rolling a die 60,000 times and display the frequency with which each face of the die finishes uppermost.

Use 6 variables to capture the frequencies and a 6-way if-else-if control structure need in the loop to increment them appropriately.

Display the results neatly as below. Note your frequencies for the rolls will be different.

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

Step: 3

blur-text-image

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

14-18 Compare the two major types of planning and control tools.

Answered: 1 week ago