1 /* 2 * A program to model a person in terms of five properties, first name and last name (String values), month, day, and year of birth (int values). 3 * Made by Hunter Gersitz | SUNY Oswego | Fall 2019 4 */ 5 package people; 6 7 public class Person { 8 9 private String firstName; 10 private String lastName; 11 private int month; 12 private int day; 13 private int year; 14 15 public Person (String name, int m, int d, int yr) { 16 int position = name.indexOf(" "); 17 this.firstName = name.substring(0, position+1); 18 this.lastName = name.substring(position + 1); 19 this.month = m; 20 this.day = d; 21 this.year = yr; 22 } 23 24 public String toString() { 25 String display = firstName + " " + lastName + ", " + "born " + month + "/" + day + "/" + year; 26 return display; 27 } 28 public String getFirstName() { 29 String fn = firstName; 30 return fn; 31 } 32 public String getLastName() { 33 String ln = lastName; 34 return ln; 35 } 36 public int getMonth() { 37 int m = month; 38 return m; 39 } 40 public int getDay() { 41 int d = day; 42 return d; 43 } 44 public int getYears() { 45 int anos = year; 46 return anos; 47 } 48 public String getInitials() { 49 String fName = firstName.substring(0, 1) + lastName.substring(0, 1); 50 String toUpperString = firstName.toUpperCase() + lastName.toUpperCase(); 51 return toUpperString; 52 } 53 public boolean getSpecialYr() { 54 return year >= 1945 && year <= 1964; 55 } 56 57 } 58