Browse Source

ready to use

master
esoe 2 years ago
parent
commit
f6fe316ca8
  1. 27
      universaty/src/main/java/ru/molokoin/App.java
  2. 24
      universaty/src/main/java/ru/molokoin/Aspirant.java
  3. 16
      universaty/src/main/java/ru/molokoin/Gender.java
  4. 68
      universaty/src/main/java/ru/molokoin/Person.java
  5. 5
      universaty/src/main/java/ru/molokoin/Student.java
  6. 10
      universaty/src/main/java/ru/molokoin/Teacher.java
  7. BIN
      universaty/target/classes/ru/molokoin/App.class
  8. BIN
      universaty/target/classes/ru/molokoin/Aspirant.class
  9. BIN
      universaty/target/classes/ru/molokoin/Gender$1.class
  10. BIN
      universaty/target/classes/ru/molokoin/Gender$2.class
  11. BIN
      universaty/target/classes/ru/molokoin/Gender$3.class
  12. BIN
      universaty/target/classes/ru/molokoin/Gender.class
  13. BIN
      universaty/target/classes/ru/molokoin/Person.class
  14. BIN
      universaty/target/classes/ru/molokoin/Student.class
  15. BIN
      universaty/target/classes/ru/molokoin/Teacher.class

27
universaty/src/main/java/ru/molokoin/App.java

@ -1,27 +0,0 @@ @@ -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) {
}
}

24
universaty/src/main/java/ru/molokoin/Aspirant.java

@ -1,24 +0,0 @@ @@ -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) {
}
}

16
universaty/src/main/java/ru/molokoin/Gender.java

@ -8,16 +8,32 @@ public enum Gender { @@ -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();
}

68
universaty/src/main/java/ru/molokoin/Person.java

@ -72,19 +72,59 @@ public class Person { @@ -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 { @@ -119,11 +159,6 @@ public class Person {
public void setCourse(String course) {
this.course = course;
}
/**
*
*/
/**
* Возвращает имя человека,
* TODO имя не может быть пустым полем или отсутствовать
@ -167,11 +202,6 @@ public class Person { @@ -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());
}
}

5
universaty/src/main/java/ru/molokoin/Student.java

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
package ru.molokoin;
public class Student extends Person{
public static final Role role = Role.STUDENT;
}

10
universaty/src/main/java/ru/molokoin/Teacher.java

@ -1,10 +0,0 @@ @@ -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);
//
}
}

BIN
universaty/target/classes/ru/molokoin/App.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Aspirant.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Gender$1.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Gender$2.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Gender$3.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Gender.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Person.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Student.class

Binary file not shown.

BIN
universaty/target/classes/ru/molokoin/Teacher.class

Binary file not shown.
Loading…
Cancel
Save