質問編集履歴
1
エラーメッセージと、途中までのコードを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,8 +66,14 @@
|
|
66
66
|
|
67
67
|
### 発生している問題・エラーメッセージ
|
68
68
|
|
69
|
+
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
|
70
|
+
PATH を変数に解決できません
|
71
|
+
PATH を変数に解決できません
|
72
|
+
PATH2 を変数に解決できません
|
69
|
-
|
73
|
+
menber を変数に解決できません
|
70
74
|
|
75
|
+
at training.test8.main(test8.java:12)
|
76
|
+
|
71
77
|
### 該当のソースコード
|
72
78
|
|
73
79
|
メインメソッドはこのようにしました。
|
@@ -104,6 +110,60 @@
|
|
104
110
|
}
|
105
111
|
|
106
112
|
|
113
|
+
package training;
|
114
|
+
|
115
|
+
import java.io.IOException;
|
116
|
+
import java.nio.file.Files;
|
117
|
+
import java.nio.file.Paths;
|
118
|
+
import java.util.ArrayList;
|
119
|
+
|
120
|
+
public class test801 {
|
121
|
+
|
122
|
+
public static ArrayList<String> maruiti(String path) throws IOException {
|
123
|
+
|
124
|
+
return new ArrayList<String>(Files.readAllLines(Paths.get(path)));
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
package training;
|
130
|
+
|
131
|
+
import java.io.IOException;
|
132
|
+
import java.util.ArrayList;
|
133
|
+
|
134
|
+
public class test802 {
|
135
|
+
// 機能② 人数を数える機能
|
136
|
+
public static int maruni() throws IOException {
|
137
|
+
ArrayList<String> list = new ArrayList<String>();
|
138
|
+
|
139
|
+
String studentFilePath1 = "C:\Users\user\Documents\Student.txt";
|
140
|
+
list = test701.maruiti(studentFilePath1);
|
141
|
+
return (int) list.stream().filter(s -> s.contains("S00")).count();
|
142
|
+
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
|
147
|
+
package training;
|
148
|
+
|
149
|
+
import java.io.IOException;
|
150
|
+
import java.util.ArrayList;
|
151
|
+
|
152
|
+
public class test803 {
|
153
|
+
//機能③ 指定した教科の合計点を出す機能
|
154
|
+
public static int marusan( String Japanese) throws IOException {
|
155
|
+
|
156
|
+
String testResultsFilePath ="C:\Users\user\Documents\test.txt";
|
157
|
+
ArrayList<String> list = new ArrayList<String>();
|
158
|
+
list = test701.maruiti(testResultsFilePath);
|
159
|
+
|
160
|
+
return (int) list.stream().filter(s -> s.contains(Japanese))
|
161
|
+
.map(sub -> sub.split(",")[3]).mapToInt(Integer::parseInt).sum();
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
107
167
|
### 試したこと
|
108
168
|
|
109
169
|
スッキリわかるJava入門、Javaの絵本購読。各サイトを調べる。
|