diff --git a/universaty/src/main/java/ru/molokoin/App.java b/universaty/src/main/java/ru/molokoin/App.java deleted file mode 100644 index 667ffab..0000000 --- a/universaty/src/main/java/ru/molokoin/App.java +++ /dev/null @@ -1,27 +0,0 @@ -package ru.molokoin; - -public class App { - private Teacher[] teachers; - private Student[] students; - private Aspirant[] aspirants; - - //инициируем исходные данные - App(){ - teachers = new Teacher[2]; - students = new Student[3]; - aspirants = new Aspirant[1]; - aspirants[0] = new Aspirant("Ronald Correa", Gender.MALE, "Computer science", "Design of a functional programming language."); - } - public void print(Person person){ - // - } - //выводим данные в консоль - public void printAll(){ - // - } - - public static void main(String[] args) { - - } - -} diff --git a/universaty/src/main/java/ru/molokoin/Aspirant.java b/universaty/src/main/java/ru/molokoin/Aspirant.java deleted file mode 100644 index 5fd78e4..0000000 --- a/universaty/src/main/java/ru/molokoin/Aspirant.java +++ /dev/null @@ -1,24 +0,0 @@ -package ru.molokoin; - -public class Aspirant extends Person{ - private String thesisTitle; - public static final Role role = Role.ASPIRANT; - - Aspirant (String name, Gender gender, String department, String thesisTitle) { - super(name, gender, department); - setThesisTitle(thesisTitle); - } - - public void setThesisTitle(String thesisTitle) { - this.thesisTitle = thesisTitle; - } - - public String getThesisTitle() { - return thesisTitle; - } - - public static void main(String[] args) { - - - } -} diff --git a/universaty/src/main/java/ru/molokoin/Gender.java b/universaty/src/main/java/ru/molokoin/Gender.java index 0311d3c..f14fbcf 100644 --- a/universaty/src/main/java/ru/molokoin/Gender.java +++ b/universaty/src/main/java/ru/molokoin/Gender.java @@ -8,16 +8,32 @@ public enum Gender { public String getPronoun(){ return "he"; } + + @Override + public String getPronounOwn() { + return "his"; + } }, FEMALE{ public String getPronoun(){ return "she"; } + @Override + public String getPronounOwn() { + return "her"; + } + }, TRANS{ public String getPronoun() { return "it"; } + + @Override + public String getPronounOwn() { + return "its"; + } }; public abstract String getPronoun(); + public abstract String getPronounOwn(); } diff --git a/universaty/src/main/java/ru/molokoin/Person.java b/universaty/src/main/java/ru/molokoin/Person.java index 55c46ef..8574851 100644 --- a/universaty/src/main/java/ru/molokoin/Person.java +++ b/universaty/src/main/java/ru/molokoin/Person.java @@ -72,19 +72,59 @@ public class Person { public static Person[] initDefaults(){ Person[] defaultList = new Person[6]; - defaultList[0] = new Person("Ronald Turner", Gender.MALE, "Computer science", Role.TEACHER); - defaultList[1] = new Person("Ruth Hollings", Gender.FEMALE, "Jurisprudence", Role.TEACHER); - defaultList[2] = new Person("Leo Wilkinson", Gender.MALE, "Computer science", Role.STUDENT); - defaultList[3] = new Person("Anna Cunningham", Gender.FEMALE, "World economy", Role.STUDENT); - defaultList[4] = new Person("Jill Lundqvist", Gender.FEMALE, "Jurisprudence", Role.STUDENT); - defaultList[5] = new Person("Ronald Correa", Gender.MALE, "Computer science", Role.ASPIRANT); + + defaultList[0] = new Person("Ronald Turner", Gender.MALE, "Computer science", + Role.TEACHER, Degree.PhD, "Programming paradigms"); + + defaultList[1] = new Person("Ruth Hollings", Gender.FEMALE, "Jurisprudence", + Role.TEACHER, Degree.MSc, "Domestic arbitration"); + + defaultList[2] = new Person("Leo Wilkinson", Gender.MALE, "Computer science", Role.STUDENT, Stage.bachelor, "III"); + + defaultList[3] = new Person("Anna Cunningham", Gender.FEMALE, "World economy", Role.STUDENT, Stage.bachelor, "I"); + + defaultList[4] = new Person("Jill Lundqvist", Gender.FEMALE, "Jurisprudence", Role.STUDENT, Stage.master, "I"); + + defaultList[5] = new Person("Ronald Correa", Gender.MALE, "Computer science", Role.ASPIRANT, "Design of a functional programming language."); + return defaultList; } /** - * Выводит общие данные о персоне в консоль + * Выводит общие данные в консоль */ public void print(){ - System.out.println("This is {name}. {He/she} {verb} at {department}"); + System.out.println("This is " + getName() + " " + + getGender().getPronoun() + " " + + getRole().getVerb() + " at " + getDepartment()); + //преподаватели + if (getRole().equals(Role.TEACHER)){ + System.out.println(getGender().getPronoun() + " has " + + getDegree() + " degree in " + + getSpeciality() + "."); + System.out.println(); + } + //студенты + if (getRole().equals(Role.STUDENT)){ + System.out.println(getGender().getPronoun() + " is " + + getCourse() + "‘th year " + getStage() + " student."); + System.out.println(); + } + + //аспиранты + if (getRole().equals(Role.ASPIRANT)){ + System.out.println(getGender().getPronounOwn() + " thesis title is " + getThesisTitle() + "."); + System.out.println(); + } + } + /** + * Выводит полный набор данных в консоль + */ + public static void printAll(Person[] persons){ + int i = 0; + while (i < persons.length){ + persons[i].print(); + i++; + } } /** @@ -119,11 +159,6 @@ public class Person { public void setCourse(String course) { this.course = course; } - - /** - * - */ - /** * Возвращает имя человека, * TODO имя не может быть пустым полем или отсутствовать @@ -167,11 +202,6 @@ public class Person { return course; } public static void main(String[] args) { - Person[] list = Person.initDefaults(); - int i = 0; - while (i < list.length){ - list[i].print(); - i++; - } + Person.printAll(Person.initDefaults()); } } diff --git a/universaty/src/main/java/ru/molokoin/Student.java b/universaty/src/main/java/ru/molokoin/Student.java deleted file mode 100644 index 583fd27..0000000 --- a/universaty/src/main/java/ru/molokoin/Student.java +++ /dev/null @@ -1,5 +0,0 @@ -package ru.molokoin; - -public class Student extends Person{ - public static final Role role = Role.STUDENT; -} diff --git a/universaty/src/main/java/ru/molokoin/Teacher.java b/universaty/src/main/java/ru/molokoin/Teacher.java deleted file mode 100644 index 44e5e7d..0000000 --- a/universaty/src/main/java/ru/molokoin/Teacher.java +++ /dev/null @@ -1,10 +0,0 @@ -package ru.molokoin; - -public class Teacher extends Person{ - public static final Role role = Role.TEACHER; - - Teacher(String name, Gender gender, String department) { - super(name, gender, department); - // - } -} diff --git a/universaty/target/classes/ru/molokoin/App.class b/universaty/target/classes/ru/molokoin/App.class deleted file mode 100644 index 5eb53cd..0000000 Binary files a/universaty/target/classes/ru/molokoin/App.class and /dev/null differ diff --git a/universaty/target/classes/ru/molokoin/Aspirant.class b/universaty/target/classes/ru/molokoin/Aspirant.class deleted file mode 100644 index 8c559a6..0000000 Binary files a/universaty/target/classes/ru/molokoin/Aspirant.class and /dev/null differ diff --git a/universaty/target/classes/ru/molokoin/Gender$1.class b/universaty/target/classes/ru/molokoin/Gender$1.class index d161225..c1bb83f 100644 Binary files a/universaty/target/classes/ru/molokoin/Gender$1.class and b/universaty/target/classes/ru/molokoin/Gender$1.class differ diff --git a/universaty/target/classes/ru/molokoin/Gender$2.class b/universaty/target/classes/ru/molokoin/Gender$2.class index 46145ad..a43f531 100644 Binary files a/universaty/target/classes/ru/molokoin/Gender$2.class and b/universaty/target/classes/ru/molokoin/Gender$2.class differ diff --git a/universaty/target/classes/ru/molokoin/Gender$3.class b/universaty/target/classes/ru/molokoin/Gender$3.class index 77d05f1..178d13b 100644 Binary files a/universaty/target/classes/ru/molokoin/Gender$3.class and b/universaty/target/classes/ru/molokoin/Gender$3.class differ diff --git a/universaty/target/classes/ru/molokoin/Gender.class b/universaty/target/classes/ru/molokoin/Gender.class index 1aaeed6..d484aa7 100644 Binary files a/universaty/target/classes/ru/molokoin/Gender.class and b/universaty/target/classes/ru/molokoin/Gender.class differ diff --git a/universaty/target/classes/ru/molokoin/Person.class b/universaty/target/classes/ru/molokoin/Person.class index 9f2fa5e..5352bb0 100644 Binary files a/universaty/target/classes/ru/molokoin/Person.class and b/universaty/target/classes/ru/molokoin/Person.class differ diff --git a/universaty/target/classes/ru/molokoin/Student.class b/universaty/target/classes/ru/molokoin/Student.class deleted file mode 100644 index e41a98c..0000000 Binary files a/universaty/target/classes/ru/molokoin/Student.class and /dev/null differ diff --git a/universaty/target/classes/ru/molokoin/Teacher.class b/universaty/target/classes/ru/molokoin/Teacher.class deleted file mode 100644 index 0cbf59d..0000000 Binary files a/universaty/target/classes/ru/molokoin/Teacher.class and /dev/null differ