Skip to content
Snippets Groups Projects
Commit 411c7515 authored by Ethan Robert's avatar Ethan Robert
Browse files

Added Person class

parent cbc575ec
No related branches found
No related tags found
No related merge requests found
public class Person {
private int ID;
private String forename;
private String name;
private static int counter;
public Person(String name, String forename) {
this.forename = forename;
this.name = name;
this.ID = Person.counter;
Person.counter++;
}
public void setName(String newName) {
this.name = newName;
}
public String getName() {
return this.name;
}
public void setForename(String newForename) {
this.forename = newForename;
}
public String getForename() {
return this.forename;
}
public int getID() {
return this.ID;
}
public String toString() {
return "" + this.ID + ": " + this.forename + " " + this.name;
}
public boolean equals(Object other) {
if (other.getClass() == this.getClass()) {
return other.ID == this.ID;
}
return false;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment