实验八第二题写完

This commit is contained in:
2024-06-16 16:01:43 +08:00
parent e15cac83f3
commit 48c37550a5
2 changed files with 15 additions and 1 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
//test.java
package step2;
import java.io.File;
@@ -10,7 +11,7 @@ public class AddTimeTable {
public static void start(String time1, String time2) throws IOException {
/********** Begin *********/
File file = new File("src/step2/AddTimeTable.java");
File file = new File("src/step2/Time_Table.txt");
FileWriter writer = new FileWriter(file);
writer.write(time1);
writer.write(LINE_SEPARATOR);
+13
View File
@@ -0,0 +1,13 @@
//test.java
package step2;
import java.io.IOException;
public class test {
public static void main(String[] args) throws IOException {
AddTimeTable addTimeTable = new AddTimeTable();
String time1 = "T246 | 郑州 | 青岛 | 15:00 | 23:00 | 8小时";
String time2 = "K765 | 西宁 | 拉萨 | 16:00 | 14:00+1 | 22小时";
addTimeTable.start(time1, time2);
}
}