Hi
I have tried to solve this task without looking at the solution.
Can someone tell me, where my error is for the last two requirements?
Thank you.
package de.codegym.task.task19.task1921;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
/*
Max Mustermann
*/
public class Solution {
public static final List<Person> PEOPLE = new ArrayList<>();
public static void main(String[] args) throws IOException {
String fileName = args[0];
try(BufferedReader reader = new BufferedReader(new FileReader(fileName))){
String line;
while ((line = reader.readLine()) != null){
String[] split = line.split(" ");
String name = "";
int count = 0;
for(int i = 0; i < split.length; i++){
Character c = split[i].charAt(0);
if(Character.isLetter(c))
name += split[i] + " ";
count = i;
}
int day = Integer.parseInt(split[count+1]);
int month = Integer.parseInt(split[count+2]);
int year = Integer.parseInt(split[count+3]);
Calendar result = new GregorianCalendar(year, month, day);
PEOPLE.add(new Person(name.trim(), result.getTime()));
}
}
}
}