From ec4bf5fcdb3f35604b6f253302e3e40502dca3ba Mon Sep 17 00:00:00 2001
From: fdzcxy212206329 <3193095586@qq.com>
Date: Thu, 10 Oct 2024 14:14:55 +0800
Subject: [PATCH 1/5] Initial commit
---
README.md | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e9e3513
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# jzzh
+
--
2.34.1
From c50b1f77958166480d6628af82b42edd7b55c48c Mon Sep 17 00:00:00 2001
From: xiexiaohang <1815965264@qq.com>
Date: Thu, 10 Oct 2024 14:42:14 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E8=BF=9B=E5=88=B6=E8=BD=AC=E6=8D=A2?=
=?UTF-8?q?=EF=BC=88=E8=B0=A2=E6=BD=87=E8=88=AA=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 3 ++
.idea/misc.xml | 6 ++++
.idea/modules.xml | 9 ++++++
.idea/vcs.xml | 6 ++++
1010Lession/1010Lession.iml | 11 +++++++
1010Lession/src/jzzh/BaseConverter.java | 41 +++++++++++++++++++++++++
gitCode.iml | 11 +++++++
7 files changed, 87 insertions(+)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/misc.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/vcs.xml
create mode 100644 1010Lession/1010Lession.iml
create mode 100644 1010Lession/src/jzzh/BaseConverter.java
create mode 100644 gitCode.iml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..359bb53
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b0ef4c1
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1010Lession/1010Lession.iml b/1010Lession/1010Lession.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/1010Lession/1010Lession.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1010Lession/src/jzzh/BaseConverter.java b/1010Lession/src/jzzh/BaseConverter.java
new file mode 100644
index 0000000..b207961
--- /dev/null
+++ b/1010Lession/src/jzzh/BaseConverter.java
@@ -0,0 +1,41 @@
+package jzzh;
+
+import java.util.Scanner;
+
+public class BaseConverter {
+ // 将任意 R 进制的数转换为十进制
+ public static int convertToDecimal(String number, int base) {
+ return Integer.parseInt(number, base);
+ }
+
+ // 将十进制数转换为任意目标进制
+ public static String convertFromDecimal(int decimalNumber, int targetBase) {
+ return Integer.toString(decimalNumber, targetBase).toUpperCase(); // 使用大写表示结果
+ }
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+
+ // 输入原始进制
+ System.out.print("请输入原始进制 (2 ≤ R ≤ 16): ");
+ int originalBase = scanner.nextInt();
+
+ // 输入需要转换的数
+ System.out.print("请输入进制数: ");
+ String number = scanner.next().toUpperCase(); // 防止字母大小写混淆
+
+ // 输入目标进制
+ System.out.print("请输入目标进制 (2 ≤ R ≤ 16): ");
+ int targetBase = scanner.nextInt();
+
+ // 将原始 R 进制数转换为十进制
+ int decimalNumber = convertToDecimal(number, originalBase);
+
+ // 将十进制数转换为目标 R' 进制
+ String result = convertFromDecimal(decimalNumber, targetBase);
+
+ // 输出结果
+ System.out.println("转换后的结果: " + result);
+ }
+}
+
diff --git a/gitCode.iml b/gitCode.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/gitCode.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
--
2.34.1
From bfb01c3ff6fcc00489553de943d14fafd55d7ae1 Mon Sep 17 00:00:00 2001
From: xiexiaohang <1815965264@qq.com>
Date: Thu, 10 Oct 2024 14:55:54 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E8=BF=9B=E5=88=B6=E8=BD=AC=E6=8D=A2?=
=?UTF-8?q?=EF=BC=88=E8=B0=A2=E6=BD=87=E8=88=AA=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 29 +++++++++++++++++++++++++++++
1010Lession/src/Main.java | 15 +++++++++++++++
src/Main.java | 15 +++++++++++++++
3 files changed, 59 insertions(+)
create mode 100644 .gitignore
create mode 100644 1010Lession/src/Main.java
create mode 100644 src/Main.java
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f68d109
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,29 @@
+### IntelliJ IDEA ###
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/1010Lession/src/Main.java b/1010Lession/src/Main.java
new file mode 100644
index 0000000..fe7aa2b
--- /dev/null
+++ b/1010Lession/src/Main.java
@@ -0,0 +1,15 @@
+//TIP 要运行代码,请按 或
+// 点击装订区域中的 图标。
+public class Main {
+ public static void main(String[] args) {
+ //TIP 当文本光标位于高亮显示的文本处时按
+ // 查看 IntelliJ IDEA 建议如何修正。
+ System.out.printf("Hello and welcome!");
+
+ for (int i = 1; i <= 5; i++) {
+ //TIP 按 开始调试代码。我们已经设置了一个 断点
+ // 但您始终可以通过按 添加更多断点。
+ System.out.println("i = " + i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Main.java b/src/Main.java
new file mode 100644
index 0000000..fe7aa2b
--- /dev/null
+++ b/src/Main.java
@@ -0,0 +1,15 @@
+//TIP 要运行代码,请按 或
+// 点击装订区域中的 图标。
+public class Main {
+ public static void main(String[] args) {
+ //TIP 当文本光标位于高亮显示的文本处时按
+ // 查看 IntelliJ IDEA 建议如何修正。
+ System.out.printf("Hello and welcome!");
+
+ for (int i = 1; i <= 5; i++) {
+ //TIP 按 开始调试代码。我们已经设置了一个 断点
+ // 但您始终可以通过按 添加更多断点。
+ System.out.println("i = " + i);
+ }
+ }
+}
\ No newline at end of file
--
2.34.1
From 31700c57bb2af91760ea044985aa504b0a2d568b Mon Sep 17 00:00:00 2001
From: xiexiaohang <1815965264@qq.com>
Date: Thu, 10 Oct 2024 14:55:54 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E8=BF=9B=E5=88=B6=E8=BD=AC=E6=8D=A2?=
=?UTF-8?q?=EF=BC=88=E8=B0=A2=E6=BD=87=E8=88=AA=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 29 +++++++++++++++++++++++++++++
1010Lession/src/Main.java | 15 +++++++++++++++
src/Main.java | 15 +++++++++++++++
3 files changed, 59 insertions(+)
create mode 100644 .gitignore
create mode 100644 1010Lession/src/Main.java
create mode 100644 src/Main.java
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f68d109
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,29 @@
+### IntelliJ IDEA ###
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/1010Lession/src/Main.java b/1010Lession/src/Main.java
new file mode 100644
index 0000000..fe7aa2b
--- /dev/null
+++ b/1010Lession/src/Main.java
@@ -0,0 +1,15 @@
+//TIP 要运行代码,请按 或
+// 点击装订区域中的 图标。
+public class Main {
+ public static void main(String[] args) {
+ //TIP 当文本光标位于高亮显示的文本处时按
+ // 查看 IntelliJ IDEA 建议如何修正。
+ System.out.printf("Hello and welcome!");
+
+ for (int i = 1; i <= 5; i++) {
+ //TIP 按 开始调试代码。我们已经设置了一个 断点
+ // 但您始终可以通过按 添加更多断点。
+ System.out.println("i = " + i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Main.java b/src/Main.java
new file mode 100644
index 0000000..fe7aa2b
--- /dev/null
+++ b/src/Main.java
@@ -0,0 +1,15 @@
+//TIP 要运行代码,请按 或
+// 点击装订区域中的 图标。
+public class Main {
+ public static void main(String[] args) {
+ //TIP 当文本光标位于高亮显示的文本处时按
+ // 查看 IntelliJ IDEA 建议如何修正。
+ System.out.printf("Hello and welcome!");
+
+ for (int i = 1; i <= 5; i++) {
+ //TIP 按 开始调试代码。我们已经设置了一个 断点
+ // 但您始终可以通过按 添加更多断点。
+ System.out.println("i = " + i);
+ }
+ }
+}
\ No newline at end of file
--
2.34.1
From 2a11aa92f88da2c549782fd84e5a2f0e076b8409 Mon Sep 17 00:00:00 2001
From: xiexiaohang <1815965264@qq.com>
Date: Thu, 10 Oct 2024 16:11:40 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E8=BF=9B=E5=88=B6=E8=BD=AC=E6=8D=A2?=
=?UTF-8?q?=EF=BC=88=E6=B7=BB=E5=8A=A0=E7=95=8C=E9=9D=A2xxh=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
1010Lession/src/jzzh/BaseConverter.java | 41 ---------
1010Lession/src/jzzh/BaseConverterApp.java | 97 ++++++++++++++++++++++
2 files changed, 97 insertions(+), 41 deletions(-)
delete mode 100644 1010Lession/src/jzzh/BaseConverter.java
create mode 100644 1010Lession/src/jzzh/BaseConverterApp.java
diff --git a/1010Lession/src/jzzh/BaseConverter.java b/1010Lession/src/jzzh/BaseConverter.java
deleted file mode 100644
index b207961..0000000
--- a/1010Lession/src/jzzh/BaseConverter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package jzzh;
-
-import java.util.Scanner;
-
-public class BaseConverter {
- // 将任意 R 进制的数转换为十进制
- public static int convertToDecimal(String number, int base) {
- return Integer.parseInt(number, base);
- }
-
- // 将十进制数转换为任意目标进制
- public static String convertFromDecimal(int decimalNumber, int targetBase) {
- return Integer.toString(decimalNumber, targetBase).toUpperCase(); // 使用大写表示结果
- }
-
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
-
- // 输入原始进制
- System.out.print("请输入原始进制 (2 ≤ R ≤ 16): ");
- int originalBase = scanner.nextInt();
-
- // 输入需要转换的数
- System.out.print("请输入进制数: ");
- String number = scanner.next().toUpperCase(); // 防止字母大小写混淆
-
- // 输入目标进制
- System.out.print("请输入目标进制 (2 ≤ R ≤ 16): ");
- int targetBase = scanner.nextInt();
-
- // 将原始 R 进制数转换为十进制
- int decimalNumber = convertToDecimal(number, originalBase);
-
- // 将十进制数转换为目标 R' 进制
- String result = convertFromDecimal(decimalNumber, targetBase);
-
- // 输出结果
- System.out.println("转换后的结果: " + result);
- }
-}
-
diff --git a/1010Lession/src/jzzh/BaseConverterApp.java b/1010Lession/src/jzzh/BaseConverterApp.java
new file mode 100644
index 0000000..15eca87
--- /dev/null
+++ b/1010Lession/src/jzzh/BaseConverterApp.java
@@ -0,0 +1,97 @@
+package jzzh;
+
+
+import javafx.application.Application;
+import javafx.geometry.Insets;
+import javafx.scene.Scene;
+import javafx.scene.control.*;
+import javafx.scene.layout.GridPane;
+import javafx.stage.Stage;
+
+public class BaseConverterApp extends Application {
+
+ // 将任意 R 进制的数转换为十进制
+ public static int convertToDecimal(String number, int base) {
+ return Integer.parseInt(number, base);
+ }
+
+ // 将十进制数转换为任意目标进制
+ public static String convertFromDecimal(int decimalNumber, int targetBase) {
+ return Integer.toString(decimalNumber, targetBase).toUpperCase();
+ }
+
+ @Override
+ public void start(Stage primaryStage) {
+ primaryStage.setTitle("Base Converter");
+
+ // 创建布局
+ GridPane grid = new GridPane();
+ grid.setPadding(new Insets(10, 10, 10, 10));
+ grid.setVgap(8);
+ grid.setHgap(10);
+
+ // 原始进制标签和输入框
+ Label originalBaseLabel = new Label("原始进制 (2-16):");
+ GridPane.setConstraints(originalBaseLabel, 0, 0);
+ TextField originalBaseInput = new TextField();
+ GridPane.setConstraints(originalBaseInput, 1, 0);
+
+ // 要转换的数字标签和输入框
+ Label numberLabel = new Label("请输入进制数:");
+ GridPane.setConstraints(numberLabel, 0, 1);
+ TextField numberInput = new TextField();
+ GridPane.setConstraints(numberInput, 1, 1);
+
+ // 目标进制标签和输入框
+ Label targetBaseLabel = new Label("目标进制 (2-16):");
+ GridPane.setConstraints(targetBaseLabel, 0, 2);
+ TextField targetBaseInput = new TextField();
+ GridPane.setConstraints(targetBaseInput, 1, 2);
+
+ // 转换按钮
+ Button convertButton = new Button("转换");
+ GridPane.setConstraints(convertButton, 1, 3);
+
+ // 结果标签
+ Label resultLabel = new Label();
+ GridPane.setConstraints(resultLabel, 1, 4);
+
+ // 设置按钮事件处理
+ convertButton.setOnAction(e -> {
+ try {
+ // 获取用户输入
+ int originalBase = Integer.parseInt(originalBaseInput.getText());
+ String number = numberInput.getText().toUpperCase();
+ int targetBase = Integer.parseInt(targetBaseInput.getText());
+
+ // 检查输入的进制范围是否合法
+ if (originalBase < 2 || originalBase > 16 || targetBase < 2 || targetBase > 16) {
+ resultLabel.setText("进制范围必须在2到16之间!");
+ } else {
+ // 执行进制转换
+ int decimalNumber = convertToDecimal(number, originalBase);
+ String result = convertFromDecimal(decimalNumber, targetBase);
+ resultLabel.setText("转换后的结果: " + result);
+ }
+ } catch (NumberFormatException ex) {
+ resultLabel.setText("输入格式错误,请检查!");
+ } catch (Exception ex) {
+ resultLabel.setText("转换失败: " + ex.getMessage());
+ }
+ });
+
+ // 将所有控件添加到布局中
+ grid.getChildren().addAll(originalBaseLabel, originalBaseInput, numberLabel, numberInput, targetBaseLabel, targetBaseInput, convertButton, resultLabel);
+
+ // 创建场景并显示
+ Scene scene = new Scene(grid, 400, 250);
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
+
+
--
2.34.1