import java.util.Scanner;
public class SubtrationQuizloop {
public static void main (String[] args) {
long startSeconds = System.currentTimeMillis() / 1000;
Scanner input = new Scanner(System.in);
int correctCount = 0, answer;
final int NUMBER_OF_QUESTIONS = 5;
final int PER_SECONDS_MINUTE = 60;
String output = "";
String isRight = "";
for (int count = 0; count < NUMBER_OF_QUESTIONS; count++) {
int number1 = (int)(Math.random() * 100);
int number2 = (int)(Math.random() * 100);
System.out.print("What's " + number1 + "-" + number2 + " ? ");
answer = input.nextInt();
if(number1 - number2 == answer) {
correctCount++;
isRight = "Right.";
}
else
isRight = "wrong.";
output += number1 + "-" + number2 + "=" + answer + "\t" + isRight + "\n";
}
long endSeconds = System.currentTimeMillis() / 1000;
int totalSeconds = (int)(endSeconds - startSeconds);
int seconds = totalSeconds % PER_SECONDS_MINUTE;
totalSeconds /= PER_SECONDS_MINUTE;
int minute = totalSeconds % PER_SECONDS_MINUTE;
int hour = totalSeconds / PER_SECONDS_MINUTE;
System.out.println("Correct count is: " + correctCount);
System.out.println("Test time is: " + hour + " hour " + minute + " minute "
+ seconds + " seconds");
System.out.println(output);
}
}