Compare commits

...

3 Commits

Binary file not shown.

@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="main:jar">
<output-path>$PROJECT_DIR$/out/artifacts/main_jar</output-path>
<root id="archive" name="src.jar">
<element id="module-output" name="src" />
</root>
</artifact>
</component>

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: src.start.Main

@ -0,0 +1,112 @@
# 数学题目生成器说明文档
## 概述
数学题目生成器是一个基于 Java 的应用程序,旨在为不同难度级别(小学、初中、高中)生成定制化的数学题目。系统支持用户认证、根据难度级别生成特定约束的题目,以及历史记录管理以存储生成的题目。应用程序确保生成的题目唯一,并保存到用户特定的文件中。
## 项目结构
项目采用模块化的设计,按功能划分为多个包,遵循面向对象编程原则。以下是项目的文件结构和每个文件的作用:
- **src/**
- **auth/**
- **Authenticator.java**:管理用户认证和难度级别切换。
- **history/**
- **HistoryManager.java**:管理题目历史记录,确保去重并保存到文件。
- **model/**
- **Level.java**:枚举类,定义小学、初中、高中三个难度级别及其中文名称。
- **User.java**:用户数据模型,封装用户名、密码和初始难度级别。
- **question/**
- **AbstractQuestionGenerator.java**:抽象基类,定义题目生成的核心逻辑。
- **ElementaryGenerator.java**:小学级别题目生成器,专注于四则运算。
- **JuniorGenerator.java**:初中级别题目生成器,包含平方根和平方运算。
- **SeniorGenerator.java**:高中级别题目生成器,包含三角函数。
- **start/**
- **Main.java**:程序入口,协调用户交互、认证和题目生成流程。
- **util/**
- **Auth.java**:提供认证相关的辅助工具方法(若有)。
- **Question.java**:提供题目生成相关的辅助工具方法(若有)。
生成的题目文件保存在以用户名为名称的目录中,例如:`张三1/2025-09-27-20-57-00.txt`。
## 系统架构
应用程序围绕以下核心类构建,每个类负责特定功能:
- **AbstractQuestionGenerator**:提供题目生成的基础框架,子类根据难度级别实现具体逻辑。
- **ElementaryGenerator**:生成小学级别的四则运算题目。
- **JuniorGenerator**:生成初中级别的题目,包含平方根和平方运算。
- **SeniorGenerator**:生成高中级别的题目,包含三角函数。
- **Authenticator**:处理用户认证和难度级别切换。
- **User**:存储用户基本信息。
- **HistoryManager**:管理题目存储和去重。
- **Main**:控制程序流程。
- **Level**:定义难度级别。
## 功能
### 1. 用户认证
- 用户通过用户名和密码登录。
- 预定义用户初始化为特定难度级别:
- 小学张三1、张三2、张三3
- 初中李四1、李四2、李四3
- 高中王五1、王五2、王五3
- 所有用户默认密码为“123”。
- 登录失败会提示用户重试。
### 2. 难度级别切换
- 用户可通过输入命令(如“切换为小学”、“切换为初中”或“切换为高中”)切换难度级别。
- 无效的切换命令会显示错误信息,并保留当前级别。
### 3. 题目生成
- 根据用户选择的难度级别生成题目。
- 用户需指定题目数量10至30之间。输入-1将退出当前用户。
- 每个难度级别有特定约束:
- **小学**:基本四则运算,包含括号,无额外约束。
- **初中**:必须包含平方根(`sqrt`)或平方运算(`^2`)。
- **高中**:必须包含三角函数(`sin`、`cos`、`tan`)。
- 生成的表达式需经过验证确保满足级别要求且包含1至5个操作数。
- 题目格式包含等号(例如:`(2 + 3) * 4 =`)。
### 4. 历史记录管理
- 题目存储在用户特定的目录中,文件名基于时间戳(例如:`yyyy-MM-dd-HH-mm-ss.txt`)。
- 系统检查重复题目,确保唯一性。
- 如果在100次尝试后无法生成唯一题目系统会输出错误并停止。
## 使用方法
1. **运行应用程序**
- **方法一**:执行 `Main` 类启动程序使用idea打开jdk版本为jdk23)。
- 系统提示输入用户名和密码。
- **方法二**:通过终端运行:
1. 打开终端,导航至包含 `main.jar` 的目录。
2. 设置终端编码为 UTF-8 以正确显示中文字符:
- 在 windows的PowerShell 中运行:`[Console]::InputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8`将编码改为UTF-8
3. 运行命令:`java -jar main.jar`
4. 系统提示输入用户名和密码。
- **注意**:生成的题目文件将保存在当前目录下以用户名为名称的文件夹中(例如:`张三1/2025-09-27-20-57-00.txt`)。
2. **登录**
- 输入有效用户名和密码(例如:`张三1 123`)。
- 认证失败时,显示错误信息并提示重试。
3. **选择难度和生成题目**
- 系统显示当前难度级别(基于用户初始级别或切换后的级别)。
- 输入题目数量10至30或切换命令例如`切换为高中`)。
- 输入-1退出当前用户返回登录界面。
4. **查看和保存题目**
- 生成的题目保存到用户目录下的文件中。
- 文件格式为编号题目,每题后有空行(例如:`1. (2 + 3) * 4 =`)。
## 示例交互
```
请输入用户名和密码空格隔开张三1 123
当前选择为小学出题
准备生成小学数学题目,请输入生成题目数量(输入-1将退出当前用户重新登录切换为初中
当前选择为初中出题
准备生成初中数学题目,请输入生成题目数量(输入-1将退出当前用户重新登录10
题目生成完成,已保存到用户文件夹。
```
## 注意事项
- 应用程序使用随机工具生成随机数和运算符,自动设置种子。
- 除法运算(`/`)可能产生非整数结果,这是允许的。
- `HistoryManager` 使用 `HashSet` 高效检查重复题目。
- 用户目录不存在时会自动创建。
- 应用程序基于控制台,使用 `Scanner` 处理输入。

@ -0,0 +1,60 @@
1. 69 + 6 =
2. 46 + 96 =
3. ((48 / (50 + 71)) - 29) - 73 =
4. 6 + 79 =
5. (6 - (3 + (68 / 48))) - 46 =
6. (78 / (74 + (25 + 91))) - 25 =
7. 68 / 47 =
8. 8 + 64 =
9. (65 / (65 + (98 + 30))) * 53 =
10. 62 + ((1 + 52) * (24 * 91)) =
11. 83 * ((35 * (92 + 12)) + 86) =
12. 80 - (28 + (39 - (65 + 97))) =
13. 10 / 66 =
14. 18 * (35 - 3) =
15. 39 - (82 / 21) =
16. (39 - 79) / 68 =
17. (((92 / 76) / 28) / 12) / 91 =
18. 30 * 95 =
19. 4 + (56 / (90 + (44 / 15))) =
20. 51 - (44 - 56) =
21. ((42 + (85 - 75)) - 22) - 98 =
22. ((94 - (48 + 62)) / 40) / 82 =
23. 59 / 11 =
24. (74 / 28) / 61 =
25. (59 * ((86 / 78) * 92)) + 36 =
26. 46 - ((67 + (27 / 4)) + 24) =
27. 94 + 34 =
28. 90 + (((50 / 62) + 39) * 7) =
29. 59 * (76 * 77) =
30. 48 / 74 =

@ -0,0 +1,60 @@
1. (5 / 70) - 50 =
2. (43 - 45) - (86 / (75 + 91)) =
3. 21 - 49 =
4. 39 * (60 - 80) =
5. (56 * (21 - 41)) + 25 =
6. (99 + ((45 - 16) / 85)) / 32 =
7. (((80 + 9) / 31) - 53) * 16 =
8. (5 - ((59 * 64) - 10)) / 49 =
9. 16 / 34 =
10. (((77 + 52) + 26) + 60) * 6 =
11. 71 - 94 =
12. ((57 + 53) * 66) - (60 + 47) =
13. 40 * 79 =
14. (36 + ((3 * 22) * 61)) - 68 =
15. 81 + 24 =
16. ((64 * (96 + 33)) / 38) * 91 =
17. 86 * (8 + ((17 * 88) * 89)) =
18. 76 / 63 =
19. (5 * 44) / 58 =
20. 21 - 57 =
21. 99 / 37 =
22. 18 / (23 + (53 - (50 * 71))) =
23. 16 / ((57 * 60) + 9) =
24. 48 - (95 * 5) =
25. 97 + 45 =
26. 20 + (58 - ((1 / 58) + 58)) =
27. 44 + (6 + (19 / 49)) =
28. 52 - 51 =
29. 17 + 10 =
30. 9 / 98 =

@ -0,0 +1,60 @@
1. sqrt(1) =
2. (96)^2 =
3. (84 * (88)^2)^2 =
4. sqrt(40) =
5. sqrt(sqrt(sqrt(44) * (13)^2)) =
6. (sqrt(15))^2 =
7. sqrt(sqrt(11 / sqrt(80))) =
8. (53)^2 =
9. sqrt(57) =
10. (68)^2 =
11. (78)^2 + sqrt(sqrt((97)^2)) =
12. (42)^2 / 93 =
13. sqrt(93) =
14. (99 / sqrt(19 + 47))^2 =
15. ((((76)^2)^2)^2)^2 =
16. sqrt(sqrt(70)) =
17. (9)^2 =
18. sqrt((sqrt(89))^2) =
19. sqrt(sqrt(59 / 78)) / 58 =
20. (41 + sqrt(2)) / 86 =
21. sqrt(41) =
22. sqrt((sqrt(51) - 81) - sqrt(42 * 35)) =
23. ((sqrt(83) - sqrt(61)) * sqrt(85 - 2)) - 8 =
24. (83 + (sqrt(64) + (9 + 50)))^2 =
25. 5 - ((sqrt(17) * (51 + 41)) - 19) =
26. (26)^2 =
27. sqrt(44) + 8 =
28. (((82 - 53) * sqrt(29))^2)^2 =
29. ((sqrt(37))^2)^2 - (52 * 45) =
30. sqrt(55) =

@ -0,0 +1,60 @@
1. tan(cos(85)) =
2. tan(cos(77) / tan(45)) / (tan(26) * cos(29)) =
3. tan(sin(41)) =
4. tan(63) =
5. tan(37 / cos(tan(13))) =
6. cos(sin(92)) =
7. sin(17) =
8. sin(59) =
9. 22 / cos(sin(97)) =
10. sin(sin(97)) + (((47 * 11) - 25) - 51) =
11. ((cos(4) + (52 / 14)) * 18) + 48 =
12. (40 + 91) + tan(54 / cos(22)) =
13. tan(tan(tan(8 / 10))) =
14. tan(tan(46) - tan(15)) - 16 =
15. tan(90) * cos(sin(64) / tan(30)) =
16. sin(((70 * 50) + (22 + 52)) / 11) =
17. sin(98) =
18. tan(98) =
19. 8 + ((9 * cos(83)) / sin(94)) =
20. 89 + (tan(sin(36)) / cos(28)) =
21. cos(65 / 83) + 65 =
22. sin(40) =
23. sin(53) =
24. sin(78) =
25. (5 + cos(54)) * tan(tan(16) - 46) =
26. (tan(58 / 34) * sin(tan(67))) / 42 =
27. sin(sin(5 + (78 - 99))) =
28. (sin(cos(60)) / sin(51)) * 52 =
29. cos(cos(sin(58 / 23))) =
30. tan(cos(36)) =

@ -0,0 +1,60 @@
1. (46 + 55) - 65 =
2. ((73 / 24) / 26) + (13 / 96) =
3. 61 - (39 * 70) =
4. 56 * (((10 - 2) / 79) + 52) =
5. (68 + 68) - ((41 * 58) + 3) =
6. 87 * (4 * ((19 + 79) / 40)) =
7. 81 - 18 =
8. ((58 * 26) - 74) - 50 =
9. 45 / 77 =
10. 75 / 40 =
11. 18 * 18 =
12. 76 + 39 =
13. 36 + 93 =
14. (94 + ((94 * 64) - 16)) / 43 =
15. 65 + 67 =
16. 44 + 61 =
17. 52 - ((83 - 49) / 66) =
18. 43 / (64 * (82 + 97)) =
19. 30 + 29 =
20. (82 / 32) - (63 * 94) =
21. 77 - ((87 / (41 - 61)) * 32) =
22. ((70 / 14) - 80) / 8 =
23. 82 / 15 =
24. 50 / (72 / 85) =
25. ((47 + (24 * 62)) + 59) + 30 =
26. 91 * 2 =
27. 19 * (77 + (33 + 52)) =
28. 92 + ((92 + 88) + 33) =
29. 76 / (26 / 44) =
30. 48 + (((99 / 95) * 32) - 44) =

@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="main:jar">
<output-path>$PROJECT_DIR$/out/artifacts/main_jar</output-path>
<root id="archive" name="src.jar">
<element id="module-output" name="src" />
</root>
</artifact>
</component>

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: src.start.Main

@ -0,0 +1,110 @@
# 数学题目生成器说明文档
## 概述
数学题目生成器是一个基于 Java 的应用程序,旨在为不同难度级别(小学、初中、高中)生成定制化的数学题目。系统支持用户认证、根据难度级别生成特定约束的题目,以及历史记录管理以存储生成的题目。应用程序确保生成的题目唯一,并保存到用户特定的文件中。
## 项目结构
项目采用模块化的设计,按功能划分为多个包,遵循面向对象编程原则。以下是项目的文件结构和每个文件的作用:
- **src/**
- **auth/**
- **Authenticator.java**:管理用户认证和难度级别切换。
- **history/**
- **HistoryManager.java**:管理题目历史记录,确保去重并保存到文件。
- **model/**
- **Level.java**:枚举类,定义小学、初中、高中三个难度级别及其中文名称。
- **User.java**:用户数据模型,封装用户名、密码和初始难度级别。
- **question/**
- **AbstractQuestionGenerator.java**:抽象基类,定义题目生成的核心逻辑。
- **ElementaryGenerator.java**:小学级别题目生成器,专注于四则运算。
- **JuniorGenerator.java**:初中级别题目生成器,包含平方根和平方运算。
- **SeniorGenerator.java**:高中级别题目生成器,包含三角函数。
- **start/**
- **Main.java**:程序入口,协调用户交互、认证和题目生成流程。
- **util/**
- **Auth.java**:提供认证相关的辅助工具方法(若有)。
- **Question.java**:提供题目生成相关的辅助工具方法(若有)。
生成的题目文件保存在以用户名为名称的目录中,例如:`张三1/2025-09-27-20-57-00.txt`。
## 系统架构
应用程序围绕以下核心类构建,每个类负责特定功能:
- **AbstractQuestionGenerator**:提供题目生成的基础框架,子类根据难度级别实现具体逻辑。
- **ElementaryGenerator**:生成小学级别的四则运算题目。
- **JuniorGenerator**:生成初中级别的题目,包含平方根和平方运算。
- **SeniorGenerator**:生成高中级别的题目,包含三角函数。
- **Authenticator**:处理用户认证和难度级别切换。
- **User**:存储用户基本信息。
- **HistoryManager**:管理题目存储和去重。
- **Main**:控制程序流程。
- **Level**:定义难度级别。
## 功能
### 1. 用户认证
- 用户通过用户名和密码登录。
- 预定义用户初始化为特定难度级别:
- 小学张三1、张三2、张三3
- 初中李四1、李四2、李四3
- 高中王五1、王五2、王五3
- 所有用户默认密码为“123”。
- 登录失败会提示用户重试。
### 2. 难度级别切换
- 用户可通过输入命令(如“切换为小学”、“切换为初中”或“切换为高中”)切换难度级别。
- 无效的切换命令会显示错误信息,并保留当前级别。
### 3. 题目生成
- 根据用户选择的难度级别生成题目。
- 用户需指定题目数量10至30之间。输入-1将退出当前用户。
- 每个难度级别有特定约束:
- **小学**:基本四则运算,包含括号,无额外约束。
- **初中**:必须包含平方根(`sqrt`)或平方运算(`^2`)。
- **高中**:必须包含三角函数(`sin`、`cos`、`tan`)。
- 生成的表达式需经过验证确保满足级别要求且包含1至5个操作数。
- 题目格式包含等号(例如:`(2 + 3) * 4 =`)。
### 4. 历史记录管理
- 题目存储在用户特定的目录中,文件名基于时间戳(例如:`yyyy-MM-dd-HH-mm-ss.txt`)。
- 系统检查重复题目,确保唯一性。
- 如果在100次尝试后无法生成唯一题目系统会输出错误并停止。
## 使用方法
1. **运行应用程序**
- **方法一**:执行 `Main` 类启动程序。
- 系统提示输入用户名和密码。
- **方法二**:通过终端运行:
1. 打开终端,导航至包含 `main.jar` 的目录。
2. 设置终端编码为 UTF-8 以正确显示中文字符:
- 在 PowerShell 中运行:`[Console]::InputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8`
3. 运行命令:`java -jar main.jar`
4. 系统提示输入用户名和密码。
- **注意**:生成的题目文件将保存在当前目录下以用户名为名称的文件夹中(例如:`张三1/2025-09-27-20-57-00.txt`)。
2. **登录**
- 输入有效用户名和密码(例如:`张三1 123`)。
- 认证失败时,显示错误信息并提示重试。
3. **选择难度和生成题目**
- 系统显示当前难度级别(基于用户初始级别或切换后的级别)。
- 输入题目数量10至30或切换命令例如`切换为高中`)。
- 输入-1退出当前用户返回登录界面。
4. **查看和保存题目**
- 生成的题目保存到用户目录下的文件中。
- 文件格式为编号题目,每题后有空行(例如:`1. (2 + 3) * 4 =`)。
## 示例交互
```
请输入用户名和密码空格隔开张三1 123
当前选择为小学出题
准备生成小学数学题目,请输入生成题目数量(输入-1将退出当前用户重新登录切换为初中
当前选择为初中出题
准备生成初中数学题目,请输入生成题目数量(输入-1将退出当前用户重新登录10
题目生成完成,已保存到用户文件夹。
```
## 注意事项
- 应用程序使用随机工具生成随机数和运算符,自动设置种子。
- 除法运算(`/`)可能产生非整数结果,这是允许的。
- `HistoryManager` 使用 `HashSet` 高效检查重复题目。
- 用户目录不存在时会自动创建。
- 应用程序基于控制台,使用 `Scanner` 处理输入。

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="689ca976-67e0-46b5-87ea-b229588804e5" name="更改" comment="">
<change beforePath="$PROJECT_DIR$/../../src/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/.idea/.name" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/.idea/checkstyle-idea.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/.idea/misc.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/.idea/modules.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/.idea/src.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/AbstractQuestionGenerator.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/Authenticator.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/ElementaryGenerator.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/HistoryManager.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/JuniorGenerator.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/Level.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/Main.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/SeniorGenerator.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/User.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/.idea/.name" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/.idea/checkstyle-idea.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/.idea/misc.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/.idea/modules.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/.idea/src.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/AbstractQuestionGenerator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/Authenticator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/ElementaryGenerator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/HistoryManager.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/JuniorGenerator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/Level.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/Main$1.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/Main.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/SeniorGenerator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/User.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/张三1/2025-09-24-08-36-42.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/张三1/2025-09-24-08-36-49.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/out/production/src/张三1/2025-09-24-08-36-54.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-08-36-42.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-08-36-49.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-08-36-54.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-12-52.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-22-13.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-22-19.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-22-21.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-22-22.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-22-57.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-22-59.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/张三1/2025-09-24-20-23-00.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../../src/王五1/2025-09-24-20-13-46.txt" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 5
}]]></component>
<component name="ProjectId" id="33HStCAZngWgCUEIJi9S6BMTqOe" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "develop",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "C:/Users/86186/Desktop/个人项目",
"应用程序.Main.executor": "Run"
}
}]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
<changelist id="689ca976-67e0-46b5-87ea-b229588804e5" name="更改" comment="" />
<created>1758972717869</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1758972717869</updated>
</task>
<servers />
</component>
</project>

@ -0,0 +1,60 @@
1. (37)^2 =
2. (sqrt(86) + (33 * 47)) + 13 =
3. (100)^2 =
4. sqrt(sqrt(93)) =
5. sqrt(82) =
6. sqrt(16) =
7. (83 + (sqrt(34))^2) + 21 =
8. (27)^2 =
9. sqrt(sqrt(97)) * 69 =
10. sqrt(((15 - 96) - 24) * 81) =
11. (49)^2 =
12. (74 / 97)^2 =
13. sqrt(20) + sqrt(sqrt(89 * 60)) =
14. sqrt(31) =
15. (69)^2 =
16. sqrt(sqrt(61)) =
17. 65 / (28)^2 =
18. sqrt((93)^2 * 39) + 34 =
19. sqrt(43) =
20. (41)^2 =
21. sqrt(sqrt(14)) =
22. sqrt(sqrt(10)) =
23. (47)^2 =
24. sqrt(45 + (22 + (22)^2)) =
25. (93)^2 =
26. (28 - (5)^2) + (58)^2 =
27. sqrt(sqrt(sqrt(38) + (26)^2)) =
28. ((sqrt(25) / 90)^2)^2 =
29. (99 * sqrt(66 / 98)) / (12 - 14) =
30. sqrt(98 + (28 + (3 + 87))) =

@ -0,0 +1,60 @@
1. (sqrt(71))^2 =
2. (87)^2 / 60 =
3. sqrt(56) =
4. (44)^2 =
5. ((84)^2)^2 =
6. (92 * sqrt(84))^2 + 58 =
7. (sqrt((69 * 8) + 33))^2 =
8. sqrt(sqrt(77)) * 90 =
9. sqrt(98 + 64) =
10. (43)^2 =
11. sqrt((65 + 17)^2 * 84) =
12. ((sqrt((35)^2))^2)^2 =
13. 96 - (sqrt(97) / sqrt(90))^2 =
14. sqrt(sqrt((99 * 55) - sqrt(50))) =
15. (sqrt(63))^2 =
16. (67)^2 =
17. sqrt(28) / sqrt(59) =
18. ((88)^2)^2 =
19. ((21)^2)^2 =
20. ((12)^2 - sqrt(95)) - 31 =
21. (51)^2 =
22. (34)^2 * (96 - 35) =
23. sqrt(sqrt((18)^2) * (sqrt(59) - 29)) =
24. (((71)^2 - 64) / 14)^2 =
25. sqrt(36) =
26. (((93)^2)^2)^2 =
27. sqrt(sqrt(5 + 71) / 98) =
28. ((71 - sqrt(59)) / sqrt(19))^2 =
29. sqrt((38 / 83)^2) =
30. sqrt(sqrt(16)) =

@ -41,7 +41,6 @@ public class Authenticator {
System.out.print("请输入用户名和密码(空格隔开):");
String inputLine = scanner.nextLine().trim();
String[] input = inputLine.split("\\s+");
if (input.length != 2) {
System.out.println("请输入正确的用户名、密码");
return null;

@ -21,6 +21,7 @@ public class Main {
*
* @param args
*/
@SuppressWarnings("unused")
public static void main(String[] args) {
Authenticator authenticator = new Authenticator();
Scanner scanner = new Scanner(System.in);
@ -35,13 +36,14 @@ public class Main {
System.out.print("准备生成" + currentLevel.getName()
+ "数学题目,请输入生成题目数量(输入-1将退出当前用户重新登录");
String inputText = scanner.nextLine().trim();
// 检查是否需要切换难度级别
if (inputText.equals("exit")) {
return;
} // 检查是否需要切换难度级别
Level newLevel = Auth.getLevel(inputText, currentLevel);
if (newLevel != null) {
currentLevel = newLevel;
continue;
}
// 处理题目生成
} // 处理题目生成
AbstractQuestionGenerator generator = Question.getGenerator(currentLevel);
Integer numQuestions = Question.getQuestionAmount(inputText);
if (numQuestions == -1) {
@ -49,8 +51,7 @@ public class Main {
}
if (numQuestions == 0) {
continue; // 输入无效,重新输入
}
// 生成并保存题目
} // 生成并保存题目
HistoryManager historyManager = new HistoryManager(user.getUsername());
List<String> questions = historyManager.getQuestion(numQuestions, generator);
historyManager.saveFile(questions, user);

@ -25,7 +25,6 @@ public class Auth {
case "高中" -> Level.SENIOR;
default -> null;
};
if (newLevel != null) {
return newLevel;
} else {
@ -35,5 +34,4 @@ public class Auth {
}
return null;
}
}

@ -1,6 +1,5 @@
package src.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import src.model.Level;
@ -82,12 +81,12 @@ public class Question {
}
return count;
}
/**
* .
*
* @return
*/
public static String generateQuestion(AbstractQuestionGenerator generator) {
String expression;
do {

Loading…
Cancel
Save