package com.javarush.task.task19.task1921;
import java.io.BufferedReader;
import java.io.FileReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/*
Хуан Хуанович
*/
public class Solution {
public static final List<Person> PEOPLE = new ArrayList<Person>();
public static void main(String[] args) {
try {
BufferedReader reader = new BufferedReader(new FileReader(/*args[0]*/"c:\\Temp\\test3.txt"));
while (reader.ready()){
String str = reader.readLine();
String[] strMas = str.split(" ");
String tempResult = strMas[strMas.length-3] + " " + strMas[strMas.length-2] + " " + strMas[strMas.length-1];
SimpleDateFormat dateFormat = new SimpleDateFormat("dd MM yyyy", Locale.ENGLISH);
Date dateResult = dateFormat.parse(tempResult);
String strResult = "";
for (int i = 0; i < strMas.length-3; i++){
strResult = strResult + " " + strMas[i];
}
PEOPLE.add(new Person(strResult, dateResult));
}
reader.close();
for (Person x : PEOPLE){
System.out.println(x.getName() + " " + x.getBirthDate());
}
}
catch (Exception e){
}
}
}
package com.javarush.task.task19.task1921;
import java.util.Date;
public class Person {
private String name;
private Date birthDate;
public Person(String name, Date birthDate) {
this.name = name;
this.birthDate = birthDate;
}
public String getName() {
return name;
}
public Date getBirthDate() {
return birthDate;
}
}