1 /* 2 * this program will model a person in terms of five properties, first name and last name (String values), month, day and year of birth (int values) 3 */ 4 5 6 package people; 7 8 public class Person implements PersonSpecification { 9 10 // instance variables 11 private String firstName; 12 private String lastName; 13 private int month; 14 private int day; 15 private int year; 16 17 18 // constructors 19 public Person(String name, int month, int day, int year) { 20 int spacePosition = name.indexOf(" "); 21 firstName= name.substring(0,spacePosition); 22 lastName = name.substring(spacePosition +1); 23 this.month = month; 24 this.day = day; 25 this.year = year; 26 } 27 28 public String toString() { 29 return firstName + " " + lastName + "," + "Born: " + month + "/" + day + "/" + year; 30 } 31 32 public String firstName() { 33 return firstName; 34 } 35 36 public String lastName() { 37 return lastName; 38 } 39 40 public int month(){ 41 return month; 42 } 43 44 public int day(){ 45 return day; 46 } 47 48 public int year(){ 49 return year; 50 } 51 52 @Override 53 public String initials() { 54 return firstName.substring( 0, 1 ).toUpperCase() + lastName.substring( 0, 1 ).toUpperCase(); 55 } 56 57 @Override 58 public boolean isBoomer() { 59 return year >= 1946 && year <= 1964; 60 } 61 } 62 63