Person.java
1    /* 
2     * A program to model a person in terms of five properties. First name and last name 
3     * (String values), month, day, and year of birth (int values). 
4     */
5    
6    package people;
7    
8    public class Person implements PersonSpecification {
9    
10       private String firstName;
11       private String lastName;
12       private int month;
13       private int day;
14       private int year;
15   
16       public Person(String name, int month, int day, int year) {
17           int space = name.indexOf(" ");
18           String firstName = name.substring(0, space);
19           String lastName = name.substring(space);
20           this.firstName = firstName;
21           this.lastName = lastName;
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       public String firstName() {
33           return firstName;
34       }
35       public String lastName() {
36           return lastName;
37       }
38       public int month() {
39           return month;
40       }
41       public int day() {
42           return day;
43       }
44       public int year() {
45           return year;
46       }
47       public String initials() {
48           String first = firstName.substring(0,1);
49           String last = lastName.substring(1,2);
50           String initials = first.toUpperCase()+last.toUpperCase();
51           return initials;
52       }
53   
54       public boolean isBoomer() {
55           if (year >= 1946) {
56               if (year <= 1964) {
57                   return true;
58               } else {
59                   return false;
60               }
61           }
62           return false;
63       }
64   }
65