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