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%

Re: HELP - Math Game Project (import.hsa*)

Write it out on paper. How would you do it if it was a real life game?

Re: HELP - Math Game Project (import.hsa*)

What do you mean write it out on paper ?

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

- if the answer is correct, add 1 to the number of correct answers

- ....

Find patterns, things that repeat, numbers you need to track. Once you find these, you can translate it fairly easily to Java code.

Re: HELP - Math Game Project (import.hsa*)

but how do you loop it so that it will always go on?

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.

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

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.

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 answer is correct, increase numberOfQuestionsAsked by 1

- 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 *

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 answer is correct, increase numberOfQuestionsAsked by 1

- 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?

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)

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!

Re: HELP - Math Game Project (import.hsa*)

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

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?

Re: HELP - Math Game Project (import.hsa*)

numbers in the math problem that increase every question

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.

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.

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

Re: HELP - Math Game Project (import.hsa*)