代码拉取完成,页面将自动刷新
import java.io.*;
import java.util.Scanner;
public class TeamExp {
public static void main(String[] args) throws IOException {
int n, l, count = 0;//需要生成的题目数量:n,语言选择:l
String answer;
File file = new File("test.txt");
InputExpression expIn = new InputExpression(file);
Calculation cal = new Calculation();
Judge jud = new Judge();
OutputExpression expOut = new OutputExpression(file);
printTip();
Scanner reader = new Scanner(System.in);
l = reader.nextInt();
ChooseLanguage choseLan = new ChooseLanguage(l);//选择语言
choseLan.lan.proNum();//提示输入生成题目个数
n = reader.nextInt();//输入题目个数
answer = reader.nextLine();
formQuestions(n, expOut);//随机生成题目输出到文件
for (int i = 0; i < n; i++) {
choseLan.lan.pro(i);
expIn.expInput();
System.out.print(expIn.str2 + "=");//打印真分数表达式
answer = reader.nextLine();//输入答案
cal.setStr(expIn.str1);//计算假分数表达式
cal.cal();
jud.setString(answer, cal.correct);
jud.judCorrect();//判断正误
choseLan.lan.jud(jud.flag, cal.correct);//语言打印
if (jud.flag == 1) {
count++;//计算正确答案个数
}
}
expIn.inClose();//关闭输入流
choseLan.lan.per(n, jud.judPer(count, n));//输出正确率
}
static void printTip() {
System.out.println("选择简体中文请输入:1");
System.out.println("選擇繁體中文請輸入:2");
System.out.println("Choose English please input:3");
}
static void formQuestions(int n, OutputExpression expout) {
CreatExp expression;
for (int i = 0; i < n; i++) {
expression = new CreatExp();
expression.setExpression();//生成表达式
expout.expOutput(expression.strFile);//输出假分数表达式到文件
expout.expOutput(expression.strPri);//输出真分数表达式到文件
}
expout.outClose();//关闭输出流
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。