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