Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Can anybody help me with is programming assignment . . . Posted by hightech8 on 29 Oct 2005 at 6:17 PM
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)?:

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

Report
Re: Can anybody help me with is programming assignment . . . Posted by icubbon on 30 Oct 2005 at 11:57 PM
: 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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.