Results 1 to 9 of 9
Like Tree5Likes
  • 3 Post By Fubarable
  • 2 Post By Fubarable

Thread: Java ... I Need Your Help so I Can Help My Son

  1. #1
    GIban is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Java ... I Need Your Help so I Can Help My Son

    First THANKS for your valuable INPUT.

    I tried to help my son with his class homework in a Java Program but was unable. So I am soliciting your help as a guide. The program is missing several coding and fails to compile.

    The Problem:

    Main method will make calls to 4 other methods as needed (logical)
    One method generates a secret number 1 to 100 (random generator)
    Another method will check your guess against the computer secret # (If-then)
    Final method will tell if you are correct and output a rating base on your attempts.

    You have 10 tries with each attempt output the following:

    1 Genius
    2 or 3 Micro Genius
    4 or 5 Cyber Brain
    6 or 7 Super Chip
    7 or 8 Techno Geek
    9 or 10 Circuit Breaker
    >10 Fail! You are a Cyber Dud!


    His CODE:

    Java Code:
    import java.util.Scanner;
    import java.util.Random;
    
    public class TheBrainGame2
    {
    static String Rating;
    static int count;
    static int Random;
    static int Guess;
    
    public static void main(String[] args)
    {
    Guess = count;
    if (count <= 10)
    {
    Rating = Rating(count);
    }
    //else if (count > 10)
    //{
    //Rating = Fail(count);
    //}
    
    //Scanner input = new Scanner(System.in);
    //int Answer;
    //int [] Answer = new int [Random];
    
    }
    
    public static int NumberGenerator(int Random)
    {
    Random RandomNumber = new Random(12);
    count = 0;
    for(int x = 0; x < 100; x++)
    {
    int Number = 1 + RandomNumber.nextInt(100);
    System.out.print(Number + " ";
    count++;
    if(count > 15)
    {
    System.out.println(" ";
    count = 0;
    }
    }
    return Random;
    }
    
    public static String Rating(int count)
    {
    {
    if(count > 10)
    Rating = "Fail! You are a Cyber Dud!";
    if(count == 10)
    Rating = "Circuit Breaker";
    if(count <= 9)
    Rating = "Techno Geek";
    if(count <= 7)
    Rating = "Super Chip";
    if(count <= 5)
    Rating = "Cyber Brain";
    if(count <= 3)
    Rating = "Micro Genius";
    if(count == 1)
    Rating = "Genius";
    }
    return Rating;
    }
    
    //public static String Fail(int count)
    //{
    //Rating = "You Lost! You are now a Cyber Dud";
    //return Rating;
    //}
    //Fail is in the if then statement
    
    public static void Answer(int Answer)
    {
    Scanner input = new Scanner(System.in);
    int x;
    System.out.println("Enter your answer please";
    x = in.nextInt();
    
    }
    
    public static String Guess(int Guess)
    {
    while(Guess != Random && count >= 10)
    System.out.println("Enter Guess #";
    if(Guess < Random)
    System.out.println("Wrong! you are too low!";
    if(Guess > Random)
    System.out.println("Wrong! you are too high!";
    if(Guess == Random)
    System.out.println("Correct! you are a ...";
    count = count + 1;
    return Rating;
    }
    }
    Last edited by GIban; 09-14-2012 at 03:50 PM. Reason: Place code in code tag permember suggestion

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,049
    Rep Power
    20

    Default Re: Java ... I Need Your Help so I Can Help My Son

    Please post code in [code] tags [/code] so it retains its formatting.
    Unformatted code is very hard to follow.

    What errors do you have and where?
    Copy and paste them.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

    Default Re: Java ... I Need Your Help so I Can Help My Son

    Forum Rules -- particularly the third paragraph
    Guide For New Members
    BB Code List - Java Programming Forum

    I tried to help my son with his class homework in a Java Program but was unable.
    So, you need to first learn Java: The Java™ Tutorials

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    GIban is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Java ... I Need Your Help so I Can Help My Son

    Java code in embedded in code tags.

    Yes, I would also need to learn the new ways of Algebra and Early Childhood Development.

    Just being a parent and trying my best to help. Sometimes when I look back, I wished I had gotten my GED and studied.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Java ... I Need Your Help so I Can Help My Son

    "He" should be the one asking here, not "you", and he needs to ask a specific question, not simply dump the work and throw up his hands. He should tell us exactly where he's stuck, show us all error messages and indicate in the code what line is causing what error, and what concepts he's confused on.
    Norm, DarrylBurke and JosAH like this.

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

    Default Re: Java ... I Need Your Help so I Can Help My Son

    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

    Default Re: Java ... I Need Your Help so I Can Help My Son

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    GIban is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Java ... I Need Your Help so I Can Help My Son

    DB,

    Yes this is me asking for assistance on my hobby forum. Sorry if it looks like I am trolling on your site but RR is where I make my first post in search of any thing. Hobby people helping hobby people. We are a unique family and occasionally will meetup at fun fly events. I also post the same question on another Java forum. Please look at the time stamp on RR post. I was up late just as well trying to see if I can crash teach myself so that I can help him.


    Fubarable,

    He's a minor so I am not sure if its allowed on this forum. I will check the forum rules. If allowed, I will have him post his question and problem. I don't want him to just get the answer, but understand how to learn the java syntax. With me asking, I can control and make suggestions in order to point him in the right diection.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Java ... I Need Your Help so I Can Help My Son

    Quote Originally Posted by GIban View Post
    He's a minor so I am not sure if its allowed on this forum.
    Minors are more than welcome here. We try to monitor the language of the forum just because of this.


    I will check the forum rules. If allowed, I will have him post his question and problem. I don't want him to just get the answer, but understand how to learn the java syntax.
    Most forum regulars will avoid simply giving out answers but rather will try to coax posters toward a solution as we value the benefits of self discovery as much as you do.
    Norm and DarrylBurke like this.

Posting Permissions

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