Person.java
1    /* 
2     * Models a person in terms of five characteristics. 
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 first = name.indexOf(" ");
17           firstName = name.substring(0,first);
18           lastName = name.substring(first+1);
19           this.month = month;
20           this.day = day;
21           this.year = year;
22       }
23   
24       public String toString() {
25           String representation = firstName + " " + lastName + ", born " + month + "/" + day + "/" + year;
26           return representation;
27       }
28   
29   
30       @Override
31       public String firstName() {
32           return firstName;
33       }
34   
35       @Override
36       public String lastName() {
37           return lastName;
38       }
39   
40       @Override
41       public int month() {
42           return month;
43       }
44   
45       @Override
46       public int day() {
47           return day;
48       }
49   
50       @Override
51       public int year() {
52           return year;
53       }
54   
55       @Override
56       public String initials() {
57           return firstName.substring(0,1) + lastName.substring(0,1);
58       }
59   
60       @Override
61       public boolean isBoomer() {
62           return year > 1943 & year < 1965;
63       }
64   }
65