Results 1 to 9 of 9
- 09-14-2012, 03:11 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
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
- 09-14-2012, 03:20 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 09-14-2012, 03:33 PM #3
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
So, you need to first learn Java: The Java™ TutorialsI tried to help my son with his class homework in a Java Program but was unable.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-14-2012, 03:54 PM #4
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
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.
-
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.
- 09-14-2012, 04:23 PM #6
Re: Java ... I Need Your Help so I Can Help My Son
Also posted at: 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.
- 09-14-2012, 05:12 PM #7
Re: Java ... I Need Your Help so I Can Help My Son
Why do they call it rush hour when nothing moves? - Robin Williams
- 09-14-2012, 06:20 PM #8
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
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.
-
Re: Java ... I Need Your Help so I Can Help My Son
Minors are more than welcome here. We try to monitor the language of the forum just because of this.
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.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.


5Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks