Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 Integer Arrays, Random Numbers, Try-Catch Validation

View previous topic View next topic Go down 
AuthorMessage
missionx3
Member
Member
avatar

Posts : 3
Join date : 2011-04-14

Integer Arrays, Random Numbers, Try-Catch Validation Empty
PostSubject: Integer Arrays, Random Numbers, Try-Catch Validation   Integer Arrays, Random Numbers, Try-Catch Validation EmptySun 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
Back to top Go down
Scars
Member
Member
avatar

Posts : 16
Join date : 2011-03-09

Integer Arrays, Random Numbers, Try-Catch Validation Empty
PostSubject: Re: Integer Arrays, Random Numbers, Try-Catch Validation   Integer Arrays, Random Numbers, Try-Catch Validation EmptySun May 01, 2011 3:49 am

Code:

[quote="missionx3"]I have no idea what I am doing for this program. Can someone help me?
Back to top Go down
 

Integer Arrays, Random Numbers, Try-Catch Validation

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» Random Numbers
» Validation
» count the item in a list without any numbers and quotations
» form validation of a checkbox not quite right
» w3c validation - please help correcting the error

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: Integer Arrays, Random Numbers, Try-Catch Validation Edit-trash Useless :: Trash-