代码如下:
package com.nfsbbs.test;
import java.util.Scanner;
public class MathsTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int MAX = 20;
final int MUST_SOLVE = 5;
int a, b;
double crt = 0;
double rate;
double startTime, endTime;
double sec;
System.out.println("Maths Test\n");
System.out.println("You need to correctly solve addition problems as quickly as you can. ");
System.out.println("You must answer " + MUST_SOLVE + " correctly before the test will end. ");
System.out.println("The operand values will be between 1 and " + MAX + ". \n");
System.out.println("Press ENTER to start the test. ");
sc.nextLine();
startTime = System.currentTimeMillis();