Results 1 to 14 of 14

Thread: I Need help

  1. #1
    xdope is offline Member
    Join Date
    Oct 2008
    Posts
    10
    Rep Power
    0

    Default I Need help

    ei guys can you help me to make a program?

    that gives a random number from 1-10 and the user will guess what will be the output number and can only try three times?
    i have no idea on how to make this.. help me out please..

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Yes we can help, we get plenty of this from today's coder. What books are you reading? Do you want to learn something or just get by a class instruction? I can help either way, but first: Do you know what a random number is?

    newbies, oh the fun!
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    xdope is offline Member
    Join Date
    Oct 2008
    Posts
    10
    Rep Power
    0

    Default

    yes it gives a random number w/out knowing what number will appear

    can you show the codes for that problem? so i can try it and simulate in my pc

  4. #4
    xdope is offline Member
    Join Date
    Oct 2008
    Posts
    10
    Rep Power
    0

    Default

    actually i am studying java for only a month a college student. and we have this project . a

  5. #5
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    "Just one month". After my first month we had already covered inheritance, polymorphism, swing, file i/o etc. I promise you you have covered this in your classes.

    The first thing you should to is check Java's API. You want to create a random number? What do you think Sun have named the class that handles just that? Also Google is a tip.

    And when you have a concrete question about your code to ask, you're welcome to post again.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Break the program up into small steps:

    First generate a random number
    Write a test program that does only this. Use println() to display the results.

    Next ask user to guess
    Write another test program that only does this.

    Get user response
    Same as above.

    After you have done the above come back with your questions on how to continue.

    Good luck.

  7. #7
    xdope is offline Member
    Join Date
    Oct 2008
    Posts
    10
    Rep Power
    0

    Default

    i really dont get it T_T

    can help me on what code should I put ?

  8. #8
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    No, no one is going to do your homework for you. That does not help you, no matter how hard you want to think it will. Read my last post again.

  9. #9
    xdope is offline Member
    Join Date
    Oct 2008
    Posts
    10
    Rep Power
    0

    Default

    im not asking you to make my homework
    im just asking what code will i put

  10. #10
    xdope is offline Member
    Join Date
    Oct 2008
    Posts
    10
    Rep Power
    0

    Default

    btw thank you for the time that you spent replying in this thread
    im just hoping that someone can give the codes to me T_T thank you in advance T_T

    signing off

  11. #11
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    Quote Originally Posted by xdope View Post
    im not asking you to make my homework
    im just asking what code will i put
    And what's the difference? :confused: I'm done trying to help you, since you won't bother yourself.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Ok, we'll get you started:
    Java Code:
    public class MyClass {
      public static void main(String[] args) {
         System.out.println("Starting main"):
        //.... put YOUR logic here
      } // end main
       // Put needed methods here
    } // end class

  13. #13
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    Covered inheritance & polymorphism? What's that, lol. ;)

    Because I'm in a good mood I'll help you, a little.

    java.lang.Math.random() generates a random number between 0 and 1. Math.random() < 1
    I die a little on the inside...
    Every time I get shot.

  14. #14
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default print( some code )

    Quote Originally Posted by xdope View Post
    ...i have no idea on how to make this.. help me out please..
    Basically you have to write some code, that is what the other posters are trying to say. If that is hard, just write some code - eventually the solution, as that may be, appears on the screen as though you had actually done some thinking. At that point, the other's harping will sound like music, which you can probably use given your displayed name.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •