
Arithmetic’s Game ??
I have to write a game to help users to improve their arithmetic calculation skills. The aim of the game is to solve maximum number of questions correctly in a limited time. The game must generate random arithmetic expressions of two and three operations with random integer operands and asks the user the answer. If the user correctly writes the answer, the program generates the next random question until the time finishes.
My outline is like that;
begin
start countdown timer
while time remaining > 0
show level1 question
get answer, check answer, update score
if correct: increase fiveInRowCorrect int by 1, else fiveInRowCorrect = 0
if fiveInRowCorrect >= 5, then time remaining += 5 seconds and fiveInRowCorrect = 0
end while
end
and I wrote somethings but I can not do the rest of the problem;
import java.util.Scanner;
public class TheGame {
public static void main (String [] args){
int count= 0;
while (count<100){
int number1 = (int)(Math.random()* 10);
int number2 = (int)(Math.random()* 10);
Scanner input = new Scanner(System.in);
System.out.print("What is " + number1 + " + " + number2 + "?");
int answer = input.nextInt();
System.out.println(number1+ " + " + number2 + " = " + answer + " is " + (number1+number2 == answer));
count++;
long endTime = System.currentTimeMillis();
long testTime= endTime  startTime;
System.out.println ("Correct count is " + correctCount + "\nTest time is " + testTime /1000 + "seconds\n" + output);
}
}
}
How can I do this java program basicly???
Thanks