From b64f5e9e206ba1f9254199a48bbec1846201d0ae Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 3 Sep 2020 10:21:33 +0200 Subject: Added first oop assignment --- sem5/oop/m1/src/Person.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sem5/oop/m1/src/Person.java (limited to 'sem5/oop/m1/src/Person.java') diff --git a/sem5/oop/m1/src/Person.java b/sem5/oop/m1/src/Person.java new file mode 100644 index 0000000..4ed517c --- /dev/null +++ b/sem5/oop/m1/src/Person.java @@ -0,0 +1,16 @@ + +public class Person { + protected String name; + protected String gender; + protected short age; + + public Person(String name, String gender, short age) { + this.name = name.equals("Victor") ? "Viktor" : name; + this.gender = gender; + this.age = age; + } + + public String toString() { + return String.format("%s[gen: %s, age: %d]", name, gender, age); + } +} -- cgit v1.2.3