missionx3 Member
Posts : 3 Join date : 2011-04-14
| Subject: Integer Arrays, Random Numbers, Try-Catch Validation Sun May 01, 2011 3:47 am | |
| 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 |
|
Scars Member
Posts : 16 Join date : 2011-03-09
| Subject: Re: Integer Arrays, Random Numbers, Try-Catch Validation Sun May 01, 2011 3:49 am | |
| - Code:
-
[quote="missionx3"]I have no idea what I am doing for this program. Can someone help me?
|
|