Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-29-2011, 02:05 AM   PM User | #1
kp2630
New to the CF scene

 
Join Date: Apr 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
kp2630 is an unknown quantity at this point
Integer Arrays, Random Numbers, Try-Catch Validation

I have no idea what I am doing for this program. Can someone help me?



You are to write a program that will simulate rolling a set of 2 or more dice with 3 or more sides, track how many times each total is thrown, then print a bar graph that shows how many times each total was thrown.

This will be coded in a single application class that is well decomposed. Well decomposed means you avoid writing duplicate code, you write several small helper methods and a single public main method. Absolutely no method can be over 20 lines long – including the header, all curly braces on individual lines, and use of white space for easily readable code.

Your program must be 100% validated – meaning if the user enters string data for integer values they get a proper error message and are required to re-enter rather than having the program blow up. Other values must also be validated (as described later). You must use at least 2 try-catch blocks for validation.

In addition you must have at least one method that has an array as a parameter variable and you must have at least one method that has an array as a return value.

You are to ask the user for the number of dice to throw – this must be at least 2.

You are to ask the user for the number of sides on each dice – this must be at least 3. All dice thrown will have the same number of sides.

You should roll the dice at least 100 times the number of dice thrown.

You should allow your user to run the application as many times as they want, changing both the number of dice and the number of sides with each round.

You must start with an explanation of the application’s function and end with an exit message thanking the user for playing.

For example if the user asks to throw 2 dice with 3 sides each the bar graph might look like this
2: ************************
3: **********************************************
4: *******************************************************************
5: ****************************************
6: ***********************
kp2630 is offline   Reply With Quote
Old 04-29-2011, 10:58 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,741
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by kp2630 View Post
I have no idea what I am doing for this program. Can someone help me?
Not if your intention is to plagiarize the code as your own. You need to post very specific questions as to the problem you are having, along with your current supporting code.
If you are at a complete loss, you must contact your instructor for clarification to the assignment.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:21 AM.


Advertisement
Log in to turn off these ads.