Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2005

Tip: Looking for answers? Try searching our database.

modifying a program

Thread view: 
patrick_woflian - 29 Nov 2005 19:58 GMT
PROBLEM:
'Modify the game to allowe the user to specify the difficulty of the
game as command line parameters:

java HiLo nDicenSides

EG java HiLo 2 6 would roll two six sided dice and add the results to
give a number between one and twelve..

after each game ask the user if they wish to play again.. store and
display their best score over all the games..

any ideas how to go about this?
Oliver Wong - 29 Nov 2005 20:23 GMT
> PROBLEM:
> 'Modify the game to allowe the user to specify the difficulty of the
[quoted text clipped - 9 lines]
>
> any ideas how to go about this?

   Whenever I roll two six sided dice and add them together, I get a number
between two and twelve (as opposed to one and twelve).

   If my memory serves, you're that person who was trying to write a game
in which a single 12 sided die was being rolled, correct? Well, assuming you
got that game working, I would first try to generalize it so that you could
roll dice with any number of sides. Once that works, I'd generalize again so
that any number of dice could be rolled.

   - Oliver


Hal Rosser - 29 Nov 2005 21:54 GMT
> PROBLEM:
> 'Modify the game to allowe the user to specify the difficulty of the
[quoted text clipped - 9 lines]
>
> any ideas how to go about this?

The command line parameters he speaks of is handled in the main easily.
That's what the (String [] args)  arguments are all about.
args[0] would have a value of "6" in the example you gave, and args[1] would
be "6".
Keep in mind these are strings.
That should be enough without writing the code for you, which your professor
wouldn't want us to do.
Roedy Green - 30 Nov 2005 00:09 GMT
On 29 Nov 2005 11:58:51 -0800, "patrick_woflian"
<gingercrock@hotmail.com> wrote, quoted or indirectly quoted someone
who said :

>any ideas how to go about this?

see http://mindprod.com/jgloss/homework.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Alan Krueger - 30 Nov 2005 03:54 GMT
> PROBLEM:
> 'Modify the game to allowe the user to specify the difficulty of the
> game as command line parameters:
[...]
> any ideas how to go about this?

Since you didn't include any information on the program that needs to be
modified, nobody reading your post can tell how it differs from the
requirements and thus what needs to be changed.

It sounds like a homework assignment though, so you may want to ask your
 teacher, instructor, professor, TA, etc.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.