# [Help] For Loops - Number Predicting Program

• December 12th, 2012, 08:06 PM
iAce
[Help] For Loops - Number Predicting Program
Hello, I need help with my code again. The steps below are the things I need in my code.

1. The computer should randomly pick a three digit lottery number ranging from 000 through 999.
2. Use a for loop to pick the single digit numbers, and concatenate them together to form a String.
3. Prompt the user to enter a thee digit number (000 through 999).
4. A number is winner if it matches the first two, the last two, or all three digits of the randomly chosen number.
5. Notify the user whether they won or lost.

How should I go about this code? I need to show that I can correctly use for loops. Any assistance would be great.
• December 12th, 2012, 09:16 PM
aesguitar
Re: [Help] For Loops - Number Predicting Program
you can use a for loop to:

1. Generate a random number x amount of times.
2. Loop through the items in an array, list, or arraylist.
3. have the user input one number at a time
4. check for equal values
5. limit the amount of tries
6. etc...

Here are some ideas to get you going. The rest shouldn't be hard. Also, this belongs in the Java Theory board.
• December 12th, 2012, 09:49 PM
iAce
Re: [Help] For Loops - Number Predicting Program
Quote:

Originally Posted by aesguitar
you can use a for loop to:

1. Generate a random number x amount of times.
2. Loop through the items in an array, list, or arraylist.
3. have the user input one number at a time
4. check for equal values
5. limit the amount of tries
6. etc...

Here are some ideas to get you going. The rest shouldn't be hard. Also, this belongs in the Java Theory board.

Okay thank you. That'll be a start. I kind of have an idea of how to do this now. Why does this belong in the Java Theory board? Because it's Java lol? Or because I don't actually have a code to start off with?
• December 13th, 2012, 04:05 PM
aesguitar
Re: [Help] For Loops - Number Predicting Program
It belongs in Theory because it does not have any errant code, let alone code period. It's called What's wrong with my Code because you can't figure out what's wrong with the code you have.