не понимаю ничего вроде похоже на то как у других.
package com.javarush.task.task17.task1710;
import java.util.Date;
import java.util.Locale;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class Person {
private String name;
private Sex sex;
private Date birthDate;
private Person(String name, Sex sex, Date birthDate) {
this.name = name;
this.sex = sex;
this.birthDate = birthDate;
}
public static Person createMale(String name, Date birthDate) {
return new Person(name, Sex.MALE, birthDate);
}
public static Person createFemale(String name, Date birthDate) {
return new Person(name, Sex.FEMALE, birthDate);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
if (sex == Sex.MALE) return "м";
else return "ж";
}
public void setSex(Sex sex) {
this.sex = sex;
}
public String getBirthDate() {
SimpleDateFormat dat = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
return dat.format(birthDate);
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
}