# HELP - Math Game Project (import.hsa*)

• 11-20-2013, 05:01 PM
lol12345
HELP - Math Game Project (import.hsa*)
Can someone explain to me how to make this program?

I get how to make random equations, but the assignment requires me to make the program increase in difficulty every 10 questions. The questions need to be increasing in difficulty forever. The program will last until the person types in "quit".

The import is import hsa.*

Create a math game for elementary school kids. Addition and subtraction are the basic skills needed to be
tested in this program. The program will randomly generate whole numbers and equations for the students.
For example, the first question might ask the student to add two single digit numbers. The second question
might ask to subtract two single digit numbers. The difficulty of the questions should increase every 10
questions. Difficulty can be increased by increasing the number of digits being added/subtracted.
When subtracting, ensure that the first number is larger than the second. The student’s current “score”
should be written on the screen. Example: You got 20 of 25 right. 80%
• 11-20-2013, 05:04 PM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Write it out on paper. How would you do it if it was a real life game?
• 11-20-2013, 05:09 PM
lol12345
Re: HELP - Math Game Project (import.hsa*)
What do you mean write it out on paper ?
• 11-20-2013, 05:15 PM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Like it says: write it out on paper. Get a piece of paper. And a pen. And start writing all the actions and ifs you would do as if it were a real life game. Since you are completely clueless, I'll start:

Game start:
- Set difficulty to 1
- Generate 2 random numbers
- Present them to the user
- Get input from the user
- ....

Find patterns, things that repeat, numbers you need to track. Once you find these, you can translate it fairly easily to Java code.
• 11-20-2013, 05:22 PM
lol12345
Re: HELP - Math Game Project (import.hsa*)
but how do you loop it so that it will always go on?
• 11-20-2013, 05:30 PM
gimbal2
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by lol12345
but how do you loop it so that it will always go on?

Excellent question! As an exercise on how to find information, try a Google for "java endless loop" and see what you get. Note how I start that search with the word "java" - that puts your problem into context for Google so you get results that are specific to Java. Search results can be daunting for people who are new to the subject, but don't give up. Read through a couple of results and see if you can figure something out. Its a good feeling when you do which will motivate you to keep going.
• 11-20-2013, 05:35 PM
lol12345
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by gimbal2
Excellent question! As an exercise on how to find information, try a Google for "java endless loop" and see what you get. Note how I start that search with the word "java" - that puts your problem into context for Google so you get results that are specific to Java. Search results can be daunting for people who are new to the subject, but don't give up. Read through a couple of results and see if you can figure something out. Its a good feeling when you do which will motivate you to keep going.

I understand how to make loops, but what I need help on is how to increase the random numbers every 10 questions
• 11-20-2013, 05:49 PM
gimbal2
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by lol12345
I understand how to make loops, but what I need help on is how to increase the random numbers every 10 questions

You were asking how to do an ENDLESS loop, not how to do a loop in general.

Regardless, you must have some idea. What have you come up with yourself so far? If you haven't gotten anywhere yet then you need to listen to the excellent advice SurfDude has given you.
• 11-20-2013, 07:30 PM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by lol12345
I understand how to make loops, but what I need help on is how to increase the random numbers every 10 questions

The answer is in the question: increase the random numbers every 10 questions.

Again: pen and paper:

- Things I want to remember: numberOfQuestionsAsked, difficulty
* Present a question to the user, taking difficulty into account
- If the numberOfQuestionsAsked is 10 then difficulty must be increased by 1, and the numberOfQuestionsAsked should be set to 0, since we start a new difficulty
- Else, give a new question, loop back to *
• 11-22-2013, 03:44 PM
lol12345
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by SurfMan
The answer is in the question: increase the random numbers every 10 questions.

Again: pen and paper:

- Things I want to remember: numberOfQuestionsAsked, difficulty
* Present a question to the user, taking difficulty into account
- If the numberOfQuestionsAsked is 10 then difficulty must be increased by 1, and the numberOfQuestionsAsked should be set to 0, since we start a new difficulty
- Else, give a new question, loop back to *

Loop back to? How do I do that?
• 11-22-2013, 03:48 PM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by lol12345
Loop back to? How do I do that?

Which Java statement is used for loops? (Hint)
• 11-22-2013, 03:52 PM
gimbal2
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by SurfMan
Which Java statement is used for loops? (Hint)

For peet's sake, Do just blurt out out already While you're at it!
• 11-23-2013, 07:41 PM
natdizzle
Re: HELP - Math Game Project (import.hsa*)
start with 2 variables x and y that increase by 1 every question
• 11-24-2013, 11:51 PM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by natdizzle
start with 2 variables x and y that increase by 1 every question

And what is "x" and "y" supposed to mean?
• 11-25-2013, 05:02 AM
natdizzle
Re: HELP - Math Game Project (import.hsa*)
numbers in the math problem that increase every question
• 11-25-2013, 10:52 AM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by natdizzle
numbers in the math problem that increase every question

And what does "X" and "Y" really stand for? I mean, if you're giving out advice, make it count. "X", is that a coordinate, a mysterious man, what? What does "X" stand for? If it's the number of questions asked, why not suggest naming it "numberOfQuestionsAsked"? I know it's 21 characters more, but a) the wear on your keyboard is neglectable, and b) it's clearer to maintain.
• 11-25-2013, 11:11 AM
gimbal2
Re: HELP - Math Game Project (import.hsa*)
I tend to meet myself half-way there; I'd call it "questionCount" which is longer and far less vague than "X" but shorter and less CaPiTalPrOne than numberOfQuestionsAsked / getNumberOfQuestionsAsked() ;)

Ah proper variable naming... so important and yet so easily tossed aside.
• 11-25-2013, 11:26 AM
SurfMan
Re: HELP - Math Game Project (import.hsa*)
Quote:

Originally Posted by gimbal2
I tend to meet myself half-way there; I'd call it "questionCount" which is longer and far less vague than "X" but shorter and less CaPiTalPrOne than numberOfQuestionsAsked / getNumberOfQuestionsAsked() ;)

Ah proper variable naming... so important and yet so easily tossed aside.

Anything better than "X" will do just fine. And no, "XX" does not count. Besides that, with a proper IDE, and I mean IntelliJ IDEA ofcourse (yeah, bring it on!) :), code completion will get me both "numberOfQuestionsAsked" and "questionCount" in 3 keystrokes. :D
• 11-25-2013, 11:31 AM
gimbal2
Re: HELP - Math Game Project (import.hsa*)
Black magic!