Page 1 of 2 12 LastLast
Results 1 to 20 of 24
Like Tree3Likes

Thread: java NOOD need serious help!

  1. #1
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default java NOOB need serious help!

    okay guys so i just started my first java class to become a programmer. im 16. i have no idea how to do any of this stuff. my teacher gave us an assignment in java and told us to do as much as we could and that he would show us how to do it next week.. heres the program

    "for this assignment you will write an application that plays a "guess my number" game using GUI elements. the game requirements are:

    --The program should select a random number 1 to 1000. The program should then ask the user to guess a number from 1 to 1000. A JtextField can be used for the guesses.

    --After each guess is input, the background color of the box should change to either blue(for cold) or red(for hot) along with a label that tells the user if they were too high or too low. When the user finally guesses the right answer, the color should be green and the box should change to uneditable. The game should ask the user if they want to play again.

    At the end of each round of play, the number of guesses it took to get the number correct should be recorded, along with the time it took. When the user indicates that they would like to stop playing the game, the relent statistics should be displayed in a dialog box before the program ends..so the user knows for each round played, how many guesses it took and the time it took to get the right answer the should hit OK on this box to end the program and the game entirely ."


    so theres the program could any one help me?? help me write the code along with explaining the lines of code?
    Last edited by JosAH; 02-18-2014 at 12:01 PM.

  2. #2
    AlexGraal is offline Señor Member
    Join Date
    Jan 2014
    Posts
    184
    Rep Power
    0

    Default Re: java NOOD need serious help!

    If this is your very first assignment, it must not be a great teacher.

    Random numbers:
    You can use
    Java Code:
    (int) (Math.random() * value)
    To generate a random value, where "value" is the upper limit. To generate up to 1000, just change value to 1000. The (int) part changes it from a double to an int so it is a whole number.
    You could do this other ways that are considered more random or more efficient or whatever, but this works just fine and it's pretty straight forward.

    I hope you know if statements, how to compare values (using >, <, ==, ||, &&, !, etc.). If you don't know that yet, nobody here will be able to help you very much.

  3. #3
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: java NOOD need serious help!

    idk whats going on. i just need to get this program by thursday..

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: java NOOD need serious help!

    That's a pretty complex assignment for a beginner class. Totally ridiculous if it's the first assignment. Tell your teacher I'm eyeballing his job...
    Get in the habit of using standard Java naming conventions!

  5. #5
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: java NOOD need serious help!

    you probly are my teacher..its the second half of a java class.. i just need help writing it. we never wrote any code in class he just shows examples on the board. wouldnt you have kids write a simple program in class together so everyone can learn?

  6. #6
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: java NOOD need serious help!

    Nobody here is going to do your homework for you. But if you make a good start and post what you've got, we can answer any specific questions you have.
    Get in the habit of using standard Java naming conventions!

  7. #7
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: java NOOD need serious help!

    i guess im just having trouble with the ordering of it all
    Last edited by jayo88; 02-18-2014 at 10:21 AM.

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,358
    Rep Power
    6

    Default Re: java NOOD need serious help!

    When I was in school 'learning' Java (I didn't learn anything, I was in stead teaching the class most of the time having already been a Java developer professionally for three years before furthering my education) I ran into one guy that set a ridiculously difficult assignment as the first one. I had no trouble doing it, but most of my classmates, except for the few fortunates that were my friends, struggled with it.

    In the end it was a test, because the code that was turned in either passed or failed but that did not depend on if it worked or not; it depended on if the teacher recognized code in it that he had seen being discussed in the popular forums in that week. Lets just say that the few people that went to a forum in stead of hitting the books hard and working with their classmates did not receive that high of a score at the end of the period.
    KevinWorkman likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: java NOOD need serious help!

    yea i guess it was pretty stupid of me to put the exact code on here.. what a dummy i am. giving students a ridiculously hard assignment JUST to see who would copy it to a forum to get some help is totally something a sick coding cave dweller WOULD do. Becoming a teacher to give out extra hard assignments just to fulfill his sick coding pleasures while the student learn nothing?if i taught a coding class for 4 hours a night i would have my class learning code..writing programs and then id give out an assignment similar to the one we did in class just a little different for a challenge... anyways..why is it looked down upon that i came to a forum to get help? i should get points for the fact that im on here trying to understand it better..i feel as though i should get this on my own. but its killing me that i cant translate it into code the way i can easily process it in my mind.i know that i want to do in the program i just cant put it into coding terms thats all. java doesnt even matter anymore its the c+ bullish*t i need to learn and if i cant even get java then i have a long way to go

  10. #10
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: java NOOD need serious help!

    Quote Originally Posted by gimbal2 View Post
    Lets just say that the few people that went to a forum in stead of hitting the books hard and working with their classmates did not receive that high of a score at the end of the period.
    What a lazy and awful way to teach.
    Get in the habit of using standard Java naming conventions!

  11. #11
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,358
    Rep Power
    6

    Default Re: java NOOD need serious help!

    I suggest you keep your cool, I was just telling an anecdote that SHOULD have told you to be a little careful in stead of blowing up like that. What's the point?

    Quote Originally Posted by kjkrum View Post
    What a lazy and awful way to teach.
    Not really, I witnessed those same students in the rest of their school carreers and they got by mostly on the efforts of others. It wasn't teaching, it was simply exposing the students from the rotters. But in the end, it was pretty much a douche yes.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  12. #12
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: java NOOD need serious help!

    thanks kj i knew it.. anyways i will write some stuff and leave it here for some critic in a few days

  13. #13
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,091
    Rep Power
    4

    Default Re: java NOOD need serious help!

    To the OP: don't try to make this work in one go. It won't happen. Chop your assignment up in small pieces. And I mean SMALL pieces. So one chop would NOT be: "Build the entire GUI", but instead the chop would be: "Create a simple window with nothing in it". Now keep chopping your problem up (and that is *NOT* your teacher) until you have all little chops that you can solve. Next part is to put them together, which by then should be fairly easy.

    This is coding 101. This assignment is not about how it looks and what it does, it is about how you learn to divide your big problem into smaller problems and then into even smaller ones.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  14. #14
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: java NOOD need serious help!

    I've been that student who ends up doing the teacher's job, and I'm bitter that I can't simply take their job without buying my way into the club.

    OP: follow this guide to asking questions and you should do all right. A teacher who docks you for asking intelligent questions is a terrible teacher. (Unfortunately, terrible teachers are a fact of life...)
    gimbal2 likes this.
    Get in the habit of using standard Java naming conventions!

  15. #15
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,778
    Blog Entries
    7
    Rep Power
    21

    Default Re: java NOOD need serious help!

    @OP: I reinstalled the original content of your thread's original post so we all know what this thread is about; your edited content didn't refect that.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  16. #16
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,040
    Rep Power
    10

    Default Re: java NOOB need serious help!

    Quote Originally Posted by jayo88 View Post
    teacher gave us an assignment in java and told us to do as much as we could and that he would show us how to do it next week..
    This might also be a "see how far people get" type assignment. The teacher might not expect anybody to finish, but it might be a way to measure students' knowledge before the class starts. Either way, the advice you received on breaking the problem down into smaller pieces is exactly what you should be doing. Which part of the assignment are you stuck on?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  17. #17
    mbschutlz97 is offline Member
    Join Date
    Jan 2014
    Posts
    30
    Rep Power
    0

    Default Re: java NOOD need serious help!

    Quote Originally Posted by jayo88 View Post
    you probly are my teacher..its the second half of a java class.. i just need help writing it. we never wrote any code in class he just shows examples on the board. wouldnt you have kids write a simple program in class together so everyone can learn?
    wow... that's just sad... I'm in AP Computer Science right now and everyday we're coding on the computers in class
    gimbal2 likes this.

  18. #18
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,358
    Rep Power
    6

    Default Re: java NOOD need serious help!

    Quote Originally Posted by mbschutlz97 View Post
    wow... that's just sad... I'm in AP Computer Science right now and everyday we're coding on the computers in class
    As you should. Outside of school time too, right?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  19. #19
    jayo88 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: java NOOD need serious help!

    na my teacher is a big CEO at some company and pretty much just talks about himself all class. he throws examples on the board and we just read through them he tells us when we get an assignment we should copy and paste the source code from one example in the book.. so for the dialog box hell be like just copy it out of another prog in the book.. i dont want to find shit and copy and paste the whole time i want to haave the knowledge in my head and its frustrating because i want to make alot of money doing this and i barely know my ass from my big toe

  20. #20
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,040
    Rep Power
    10

    Default Re: java NOOD need serious help!

    I empathize with you, but keep in mind that many people learn how to program without a teacher or fellow students or a tutor or a textbook or any of the other perks that come with being a student. You're on a technical forum, so you probably aren't going to see a lot of group hugs and commiseration here.

    However, you've already been given the key to solving this: you have to break your problem down into smaller individual pieces. You'll probably end up writing several small standalone programs before you combine them into a larger program that more closely resembles your actual goal. Then when you get stuck on a specific piece of the program, you can ask a specific technical question about it. It's much harder to answer general "how do I do this" type questions than it is to answer questions like "I tried to do X, expected Y, but Z happened instead", especially if that question comes with a small program we can copy and paste to try ourselves.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Page 1 of 2 12 LastLast

Posting Permissions

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