I'm trying to yes...do an assignment, but can't seem to wrap my head around it for some reason.
The assignment is:
-Create a lottery game application.
-Generate three random numbers from 0-9
-Allow the user to guess three numbers.
-Compare each of the users guesses to the three random numbers and
display a message that includes the users guesses and the randomly generated numbers and the amount of $$ won.
-The applications should accomadate repeating numbers.
(ie. the user guesses 1,2,3 and 1,1,1 comes up..he/she should only get credit for the one "1")
I've been going back and forth with different thoughts on how to proceed, and build on what I have.(if possible).
I'm coming here in hopes there is someone, who can guide me in the right direction.
This is where I am so far.
I would write this as a command line application first, without worrying about the GUI components. Once you have the logic working (your "model"), then you can connect it to a GUI (your "view").
As for the logical model, you already have the problem fairly well defined in English. I would suggest writing each of these "tasks" as a separate Java method. For example, you might write a method generateRandomNumbers(), or getUserInput(), or displayResults()...
I think you'll find it helpful breaking the assignment down into parts like this. Try that, and see how it goes.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Please UseCodeTags. Unformatted code/config/etc. is difficult to read. You can edit your post to include them using the button or re-post the question with proper formatting.
A Mann
Greenhorn
Joined: Sep 10, 2009
Posts: 0
posted
0
I agree with Marc - write a command line application first, and break the task down into manageable chunks (or 'methods').
For overall structure you could maybe try something like this.
(I'm a noob too when it comes to Java, so this is far from perfect, but hopefully helps a little)
Obviously come back and ask again if you get stuck on any of those methods, or anything in this is unclear.
Good Luck
Cutter Jones
Greenhorn
Joined: Sep 05, 2009
Posts: 2
posted
0
Thank you...
Unfortuanatly, we haven't learned "array" yet...I could probably firgure it out, but I don't think that would go over well with my teacher.
I guess my first problem is how do I compare a user input of one 3 digit number to the random 3 one digit numbers...?
There should be a logical way to do this....at least one that a noob like me can understand.
If anybody wishes to continue discussion about deleting text, please go to a duplicate of this thread here. The posts about deleting text will be removed from this copy of the thread.