From e15cac83f38da11f05df30a39d90d12a23b375b0 Mon Sep 17 00:00:00 2001 From: msksbr Date: Sun, 16 Jun 2024 15:55:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=85=AB=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E9=A2=98Time=5FTable.txt=E5=AD=98=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 实验8/bin/step2/这里是第二题 | 1 + 实验8/src/step2/AddTimeTable.java | 22 ++++++++++++++++++++++ 实验8/src/step2/Time_Table.txt | 7 +++++++ 实验8/src/step2/这里是第二题 | 1 + 4 files changed, 31 insertions(+) create mode 100644 实验8/bin/step2/这里是第二题 create mode 100644 实验8/src/step2/AddTimeTable.java create mode 100644 实验8/src/step2/Time_Table.txt create mode 100644 实验8/src/step2/这里是第二题 diff --git a/实验8/bin/step2/这里是第二题 b/实验8/bin/step2/这里是第二题 new file mode 100644 index 0000000..09a225a --- /dev/null +++ b/实验8/bin/step2/这里是第二题 @@ -0,0 +1 @@ +这里是第二题 \ No newline at end of file diff --git a/实验8/src/step2/AddTimeTable.java b/实验8/src/step2/AddTimeTable.java new file mode 100644 index 0000000..833dce4 --- /dev/null +++ b/实验8/src/step2/AddTimeTable.java @@ -0,0 +1,22 @@ +package step2; + +import java.io.File; +import java.io.FileWriter; +import java.io.FileReader; +import java.io.IOException; + +public class AddTimeTable { + private static final String LINE_SEPARATOR = System.getProperty("line.separator"); // 定义LINE_SEPARATOR常量,表示换行符 + + public static void start(String time1, String time2) throws IOException { + /********** Begin *********/ + File file = new File("src/step2/AddTimeTable.java"); + FileWriter writer = new FileWriter(file); + writer.write(time1); + writer.write(LINE_SEPARATOR); + writer.write(time2); + writer.write(LINE_SEPARATOR); + writer.close(); + /********** End *********/ + } +} diff --git a/实验8/src/step2/Time_Table.txt b/实验8/src/step2/Time_Table.txt new file mode 100644 index 0000000..d35d1ef --- /dev/null +++ b/实验8/src/step2/Time_Table.txt @@ -0,0 +1,7 @@ +车次 | 始发站 | 终点站 | 发车时间 | 到达时间 | 历时 +-----|---------|---------|----------|----------|----- +G123 | 北京 | 上海 | 07:00 | 12:30 | 5小时30分 +D456 | 广州 | 成都 | 08:30 | 18:00 | 9小时30分 +T789 | 深圳 | 西安 | 09:00 | 22:00 | 13小时 +K654 | 杭州 | 昆明 | 10:00 | 07:00+1 | 21小时 +Z321 | 南京 | 哈尔滨 | 11:00 | 09:00+1 | 22小时 \ No newline at end of file diff --git a/实验8/src/step2/这里是第二题 b/实验8/src/step2/这里是第二题 new file mode 100644 index 0000000..09a225a --- /dev/null +++ b/实验8/src/step2/这里是第二题 @@ -0,0 +1 @@ +这里是第二题 \ No newline at end of file