Can anybody help me with is programming assignment . . . - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Can anybody help me with is programming assignment . . .

hightech8hightech8 Posts: 1Member
Write a program to simulate rolling dices as follows:

Use the method Math.random( ) to generate random integers bewteen 1 and 6 (see my class notes to review how to do this).
Then generate ten-thousand numbers between 1 and 6. The calculate the number of 1 that has appeared, the number of 2 that has appeared, and so on. The final output must be on a dialog box (using JOptionPane). The process must be looped until the user decides to quit (you may want to look at Lab in Week 7). The output format (not the actual numbers) should like the following:

*****************************************
The dice has been rolled ten-thousand times, here is the statitics

The number of 1s appeared is 2000
The number of 2s appeared is 2000
The number of 3s appeared is 2000
The number of 4s appeared is 2000
The number of 5s appeared is 1000
The number of 6s appeared is 1000

Do you want to try again (Y/N)?:

*********************************************

Comments

  • icubbonicubbon Posts: 5Member
    : Write a program to simulate rolling dices as follows:
    :
    : Use the method Math.random( ) to generate random integers bewteen 1 and 6 (see my class notes to review how to do this).
    : Then generate ten-thousand numbers between 1 and 6. The calculate the number of 1 that has appeared, the number of 2 that has appeared, and so on. The final output must be on a dialog box (using JOptionPane). The process must be looped until the user decides to quit (you may want to look at Lab in Week 7). The output format (not the actual numbers) should like the following:
    :
    : *****************************************
    : The dice has been rolled ten-thousand times, here is the statitics
    :
    : The number of 1s appeared is 2000
    : The number of 2s appeared is 2000
    : The number of 3s appeared is 2000
    : The number of 4s appeared is 2000
    : The number of 5s appeared is 1000
    : The number of 6s appeared is 1000
    :
    : Do you want to try again (Y/N)?:
    :
    : *********************************************
    :
    :

    We wont do your homework, but we will help you with specific questions.
Sign In or Register to comment.