/home/jfernan6/NetBeansProjects/CSX/src/people/Person.java
 1 /*
 2  * This program will model a person with 5 instance variables and a to string method
 3  */
 4 package people;
 5 
 6 /**
 7  *
 8  * @author jfernan6
 9  */
10 //Creation of class and implementing person specification interface
11 public class Person implements PersonSpecification {
12 //Instance Variables of person class
13 private String firstName;
14 private String lastName;
15 private int month;
16 private int day;
17 private int year;
18 //CONSTRUCTOR
19 Person(String name, int month, int day, int year){
20     int index = name.indexOf(" ");
21     this.firstName = name.substring(0,index);
22     this.lastName = name.substring(index + 1);
23     this.month = month;
24     this.day = day;
25     this.year = year;
26    
27      
28         
29 }
30     // METHOD THAT DISPLAYS/RETURNS THE PERSONS INSTANCE VARIABLES
31     public String toString() {
32         return this.firstName + " " + this.lastName + ", born " + this.month +"/" + this.day +"/" + this.year; 
33     }
34 
35     
36     public String firstName() {
37         return this.firstName;
38     }
39 
40     
41     public String lastName() {
42        return this.lastName;
43     }
44 
45     
46     public int month() {
47         return this.month;
48     }
49 
50    
51     public int day() {
52         return this.day;
53     }
54 
55     
56     public int year() {
57         return this.year;
58     }
59 
60     
61     public String initials() {
62         return this.firstName.substring(0,1) + "." + this.lastName.substring(0,1);
63                 }
64     
65     public boolean isBoomer() {
66         return (this.year >= 1946 && this.year <=1964);
67     }
68 }
69