Person.java
1    /* 
2     * This program models a person in terms of five properties, first name and last name, month , day, and year of birth. 
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   
16       public Person(String name, int month, int day, int year) {
17           int spacePosition = name.indexOf(" ");
18           firstName = name.substring(0, spacePosition);
19           lastName = name.substring(spacePosition + 1);
20           this.month = month;
21           this.day = day;
22           this.year = year;
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           if (year >= 1940 && year <= 1965) {
56               return true;
57           } else {
58               return false;
59           }
60       }
61   }