質問編集履歴
1
エラーメッセージと、途中までのコードを追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -134,7 +134,19 @@
|
|
134
134
|
|
135
135
|
|
136
136
|
|
137
|
+
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
|
138
|
+
|
139
|
+
PATH を変数に解決できません
|
140
|
+
|
141
|
+
PATH を変数に解決できません
|
142
|
+
|
143
|
+
PATH2 を変数に解決できません
|
144
|
+
|
145
|
+
menber を変数に解決できません
|
146
|
+
|
147
|
+
|
148
|
+
|
137
|
-
|
149
|
+
at training.test8.main(test8.java:12)
|
138
150
|
|
139
151
|
|
140
152
|
|
@@ -210,6 +222,114 @@
|
|
210
222
|
|
211
223
|
|
212
224
|
|
225
|
+
package training;
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
import java.io.IOException;
|
230
|
+
|
231
|
+
import java.nio.file.Files;
|
232
|
+
|
233
|
+
import java.nio.file.Paths;
|
234
|
+
|
235
|
+
import java.util.ArrayList;
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
public class test801 {
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
public static ArrayList<String> maruiti(String path) throws IOException {
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
return new ArrayList<String>(Files.readAllLines(Paths.get(path)));
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
package training;
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
import java.io.IOException;
|
262
|
+
|
263
|
+
import java.util.ArrayList;
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
public class test802 {
|
268
|
+
|
269
|
+
// 機能② 人数を数える機能
|
270
|
+
|
271
|
+
public static int maruni() throws IOException {
|
272
|
+
|
273
|
+
ArrayList<String> list = new ArrayList<String>();
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
String studentFilePath1 = "C:\Users\user\Documents\Student.txt";
|
278
|
+
|
279
|
+
list = test701.maruiti(studentFilePath1);
|
280
|
+
|
281
|
+
return (int) list.stream().filter(s -> s.contains("S00")).count();
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
}
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
package training;
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
import java.io.IOException;
|
298
|
+
|
299
|
+
import java.util.ArrayList;
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
public class test803 {
|
304
|
+
|
305
|
+
//機能③ 指定した教科の合計点を出す機能
|
306
|
+
|
307
|
+
public static int marusan( String Japanese) throws IOException {
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
String testResultsFilePath ="C:\Users\user\Documents\test.txt";
|
312
|
+
|
313
|
+
ArrayList<String> list = new ArrayList<String>();
|
314
|
+
|
315
|
+
list = test701.maruiti(testResultsFilePath);
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
return (int) list.stream().filter(s -> s.contains(Japanese))
|
320
|
+
|
321
|
+
.map(sub -> sub.split(",")[3]).mapToInt(Integer::parseInt).sum();
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
213
333
|
### 試したこと
|
214
334
|
|
215
335
|
|