优化JavaS优化了一些细节

develop
lzy 7 days ago
parent 8e31139475
commit 9b6837aad5

@ -30,4 +30,5 @@
## 4. 注意事项 ## 4. 注意事项
- 题目数量仅支持10-30输入其他数字除-1外会退出登录。 - 题目数量仅支持10-30输入其他数字除-1外会退出登录。
- 生成的题目保存在项目根目录`generated_papers`下的用户文件夹中。 - 生成的题目保存在项目根目录`generated_papers`下的用户文件夹中。
- 切换学段时需严格按照“切换为小学/初中/高中”格式输入,否则提示无效。 - 切换学段时需严格按照“切换为小学/初中/高中”格式输入,否则提示无效。
- jdk版本为19。

@ -17,11 +17,11 @@ public class Main {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("=== 中小学数学卷子自动生成程序 ==="); System.out.println("=== 中小学数学卷子自动生成程序 ===");
while (true) { while (true) {
// 1. 登录流程(完全不变) // 1. 登录流程
String username = login(); String username = login();
if (username == null) continue; if (username == null) continue;
// 2. 登录后操作:初始学段为账号对应的学段(完全不变) // 2. 登录后操作:初始学段为账号对应的学段
String currentType = AccountManager.getAccountType(username); String currentType = AccountManager.getAccountType(username);
while (true) { while (true) {
// 提示信息:始终使用当前有效的 currentType无效切换后不变 // 提示信息:始终使用当前有效的 currentType无效切换后不变
@ -35,7 +35,7 @@ public class Main {
continue; continue;
} }
// 处理题目数量输入(完全不变) // 处理题目数量输入
int count = parseCount(input); int count = parseCount(input);
if (count == -1) { if (count == -1) {
System.out.println("退出当前用户,返回登录界面..."); System.out.println("退出当前用户,返回登录界面...");
@ -79,8 +79,7 @@ public class Main {
} }
/** /**
* currentType * currentType
*
*/ */
private static String handleTypeSwitch(String input, String currentType) { private static String handleTypeSwitch(String input, String currentType) {
String targetType = input.substring(3).trim(); String targetType = input.substring(3).trim();

@ -1,4 +1,3 @@
// 修改后的PrimaryQuestionGenerator.java
package com.mathpaper.question; package com.mathpaper.question;
import com.mathpaper.util.Utils; import com.mathpaper.util.Utils;

@ -1,4 +1,3 @@
// mathpaper/question/QuestionChecker.java
package com.mathpaper.question; package com.mathpaper.question;
import com.mathpaper.file.FileHandler; import com.mathpaper.file.FileHandler;

@ -1,4 +1,3 @@
// 修改后的SeniorQuestionGenerator.java
package com.mathpaper.question; package com.mathpaper.question;
import com.mathpaper.util.Utils; import com.mathpaper.util.Utils;

@ -29,13 +29,13 @@ public class Utils {
// 生成三角函数 // 生成三角函数
public static String getTrigFunc() { public static String getTrigFunc() {
String func = TRIG_FUNCS[RANDOM.nextInt(TRIG_FUNCS.length)]; String func = TRIG_FUNCS[RANDOM.nextInt(TRIG_FUNCS.length)];
int angle = RANDOM.nextInt(181); int angle = RANDOM.nextInt(101);
return func + "(" + angle + ")°"; return func + "(" + angle + ")";
} }
// 生成平方 // 生成平方
public static String getSquare(String num) { public static String getSquare(String num) {
return num + "\u00B2"; return num + "²";
} }
// 生成开根号 // 生成开根号

Loading…
Cancel
Save