/* * A program to develop a class which can be represent Persons objects. */ package people; public class Person implements PersonSpecification{ // the five instance variables private String firstName; private String lastName; private int month; private int day; private int year; // the constructor public Person(String name,int nrOfMonth, int nrOfDay, int nrOfYear) { this.firstName = name.substring(0,name.indexOf(" ")); this.lastName = name.substring(name.indexOf(" ")); this.month = nrOfMonth; this.day = nrOfDay; this.year = nrOfYear; } public String name() {return firstName + lastName;} @Override public String firstName() { return firstName; } @Override public String lastName() { return lastName; } public int month() {return month;} public int day() {return day;} public int year() {return year;} public String toString() { return name() + "," + " born " + month() + "/" + day() + "/" + year(); } public String initials() { return firstName.substring(0,1)+ lastName.substring(1,2); } public boolean isBoomer() { return (year >= 1946 && year <= 1964); } }