Program Help

A guessing game, generate a number between 1 and 10. Have the user try to guess the number three times. If the user guesses within three tries, give a congratulatory message. If the user doesn't guess, then tell the user what the number was.


Comments

  • : A guessing game, generate a number between 1 and 10. Have the user try to guess the number three times. If the user guesses within three tries, give a congratulatory message. If the user doesn't guess, then tell the user what the number was.
    :
    :
    :

    That sounds like the assignment, what ideas have you come up with so far?
    It's ok to be 'wrong' or confused. It's part of what we often go through to learn.

    The slowest runner in the race usually gets more cheers than some guy 20 places up. The guy hiding in the bushes near the finish line gets jeered and booed when caught.

    btw Just such a game comes with the Jakarta Server.




  • : : A guessing game, generate a number between 1 and 10. Have the user try to guess the number three times. If the user guesses within three tries, give a congratulatory message. If the user doesn't guess, then tell the user what the number was.
    : :
    : :
    : :
    :
    : That sounds like the assignment, what ideas have you come up with so far?
    : It's ok to be 'wrong' or confused. It's part of what we often go through to learn.
    :
    : The slowest runner in the race usually gets more cheers than some guy 20 places up. The guy hiding in the bushes near the finish line gets jeered and booed when caught.
    :
    : btw Just such a game comes with the Jakarta Server.
    :
    :
    :
    :
    :
    I haven't gotten any clue really. This isn't really an assignment, trying to teach this stuff myself and the lesson in the back gives this as a project to try. Can't think of what to do, trying to do both this and visual basic work. I thought java would be easy so that's why I decided to teach myself, but not working to well. If there is any way you can lead me on or explain that would be great. Thanks in advance.
  • : : : A guessing game, generate a number between 1 and 10. Have the user try to guess the number three times. If the user guesses within three tries, give a congratulatory message. If the user doesn't guess, then tell the user what the number was.
    : : :
    : : :
    : : :
    : :
    : : That sounds like the assignment, what ideas have you come up with so far?
    : : It's ok to be 'wrong' or confused. It's part of what we often go through to learn.
    : :
    : : The slowest runner in the race usually gets more cheers than some guy 20 places up. The guy hiding in the bushes near the finish line gets jeered and booed when caught.
    : :
    : : btw Just such a game comes with the Jakarta Server.
    : :
    : :
    : :
    : :
    : :
    : I haven't gotten any clue really. This isn't really an assignment, trying to teach this stuff myself and the lesson in the back gives this as a project to try. Can't think of what to do, trying to do both this and visual basic work. I thought java would be easy so that's why I decided to teach myself, but not working to well. If there is any way you can lead me on or explain that would be great. Thanks in advance.
    :
    you know where i can get examples of java programs? everytime i search i keep getting javascript examples.

  • This exact "game" is a demo in the Apache/Jakarta servelets demo. There is source code I'm pretty sure, however It also includes server stuff. It's also a big download with a lot of other stuff.

    programmers heaven has it too it seems.
    http://www.programmersheaven.com/zone13/cat554/27297.htm

    more source code examples at ph.
    http://www.programmersheaven.com/zone13/mh32.htm

    up one level and there's also tutorials.
    --------------

    To work out the program, break it down into simple concepts.

    User Input.
    Computer generation of random numbers
    test user input
    process result


    User Input:
    A gui TextField in an applet or Fram would be easy.
    Also possible is a consol input stream.

    Computer generation of random numbers
    check out java.util.Random class
    also java.lang.Math.random () could be used. Better is the java.util.Random class.

    test user input
    user input will generally be a string and the random number will be an int . This leads to a comparison issue, which is easy to solve - either turn the number into a string, or the string into a number.
    There's about a dozen ways of converting a number into a string including the trivial
    int numb= new Random().nextInt(10);
    String st_numb = ""+numb.

    process result
    if user is wrong play a raspberry sound and incriment the wrong guess variable.
    if user is right play a victoy song, flash blink and wire prizemoney into his pay pal account.

    lets see how far you get and where you get stuck.

    Also check out http://java.sun.com for API's (java docs), tutorials and examples.
    read the java newsgroups too.


    ~S~








    : : : : A guessing game, generate a number between 1 and 10. Have the user try to guess the number three times. If the user guesses within three tries, give a congratulatory message. If the user doesn't guess, then tell the user what the number was.
    : : : :
    : : : :
    : : : :
    : : :
    : : : That sounds like the assignment, what ideas have you come up with so far?
    : : : It's ok to be 'wrong' or confused. It's part of what we often go through to learn.
    : : :
    : : : The slowest runner in the race usually gets more cheers than some guy 20 places up. The guy hiding in the bushes near the finish line gets jeered and booed when caught.
    : : :
    : : : btw Just such a game comes with the Jakarta Server.
    : : :
    : : :
    : : :
    : : :
    : : :
    : : I haven't gotten any clue really. This isn't really an assignment, trying to teach this stuff myself and the lesson in the back gives this as a project to try. Can't think of what to do, trying to do both this and visual basic work. I thought java would be easy so that's why I decided to teach myself, but not working to well. If there is any way you can lead me on or explain that would be great. Thanks in advance.
    : :
    : you know where i can get examples of java programs? everytime i search i keep getting javascript examples.
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories