diff --git a/src/tp04/Person.java b/src/tp04/Person.java new file mode 100644 index 0000000000000000000000000000000000000000..bd8dac6a0fa095499a6e2049e6e6e255a94f82be --- /dev/null +++ b/src/tp04/Person.java @@ -0,0 +1,48 @@ +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