代码如下:
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();
for(int solve = 1; solve <= MUST_SOLVE; solve++) {
a = (int) (Math.ra

本文介绍了如何使用Java编写一个程序,该程序提供五个加减法测验,并记录用户的答题正确率及完成测验所花费的时间,帮助用户了解自己的计算速度和准确度。
最低0.47元/天 解锁文章
301

被折叠的 条评论
为什么被折叠?



