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