Person - { return fName; } public void setAge ( int yrs ) {...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class Person { // instance variables, local fields // each object gets its own copy of these protected String lName; protected String fName; protected int age; protected int SSN; Person () { lName = "Last"; fName = "First"; age = 18; SSN = 123456789; } // accessors public void setLName ( String name ) { lName = name; } public String getLName () { return lName; } public void setFName ( String name ) { fName = name; } public String getFName ()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return fName; } public void setAge ( int yrs ) { age = yrs; } public int getAge () { return age; } public void setSSN ( int num ) { SSN = num; } public int getSSN () { return SSN; } // general methods public boolean isSenior () {return (age >= 60);} public boolean isMinor () {return (age < 18);} public boolean isOlder (Person p) { return (age > p.getAge()); } }...
View Full Document

This note was uploaded on 11/30/2009 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Ask a homework question - tutors are online