I'm tryin to make a game in java which is like guessing the number.
eg:The number is 345 and the user enters lets say 123, so like the
program is supposed to return dat one digit was guessed correctly and
none were guessed correctly in their right positions. Can i get some
help please for the second part of the program. And also how i use the
random function to generate a different 3-duigit number.
Thanks a lot for your hep guys.
> I'm tryin to make a game in java which is like guessing the number.
Let me guess that the initial motivation is a piece of paper
giving you the rough idea and a date as deadline until is has
to be finished ;-)
> eg:The number is 345 and the user enters lets say 123, so like the
> program is supposed to return dat one digit was guessed correctly and
> none were guessed correctly in their right positions.
Here you have to ask yourself how the positions are counted.
If the number is 1234 and you guess 1 should it be seen as
1000 or 0001?.
> Can i get some
> help please for the second part of the program.
You should see the number as text instead of a number. Reading
the Javadoc for java.lang.String might give you ideas how to
solve this part of the homework.
> And also how i use the
> random function to generate a different 3-duigit number.
The necessary functions are grouped within java.lang.Math.
As well here, a look into the Javadocs will give you the
necessary ideas what methods are to be used.
In case you don't have the Javadoc at hand:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
If you still need hints or help, feel free to come back with
more concrete questions.
Regards, Lothar

Signature
Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
Always remember: The answer is forty-two, there can only be wrong
questions!
>I'm tryin to make a game in java which is like guessing the number.
>eg:The number is 345 and the user enters lets say 123, so like the
[quoted text clipped - 3 lines]
>random function to generate a different 3-duigit number.
>Thanks a lot for your hep guys.
You want to be able to take a number apart into digits. This is very
similar to the task of converting it to a string.
In a loop both divide by 10 and take the remainder modulo 10. This
peels the digits off right to left.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
>I'm tryin to make a game in java which is like guessing the number.
>eg:The number is 345 and the user enters lets say 123, so like the
[quoted text clipped - 3 lines]
>random function to generate a different 3-duigit number.
>Thanks a lot for your hep guys.
see http://mindprod.com/jgloss/pseudorandom.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com