1 package people; 2 3 public class Person implements PersonSpecification { 4 5 private String firstName; 6 private String lastName; 7 private int month; 8 private int day; 9 private int year; 10 11 public Person(String name, int month, int day, int year) { 12 int spacePosition = name.indexOf(" "); 13 firstName = name.substring(0, spacePosition); 14 lastName = name.substring(spacePosition + 1); 15 this.month = month; 16 this.day = day; 17 this.year = year; 18 } 19 20 public String toString() { 21 return firstName + " " + lastName + "," + " " + "Born: " + month + "/" + day + "/" + year; 22 } 23 24 public String firstName() { 25 return firstName; 26 } 27 28 public String lastName() { 29 return lastName; 30 } 31 32 public int month() { 33 return month; 34 } 35 36 public int day() { 37 return day; 38 } 39 40 public int year() { 41 return year; 42 } 43 44 public String initials() { 45 return firstName.substring(0,1).toUpperCase() + lastName.substring(0,1).toUpperCase(); 46 } 47 48 public boolean isBoomer() { 49 return year >= 1946 && year <= 1964; 50 } 51 } 52 53