From f6fe316ca812fac7ea9cedbd2d3d5fa415f62c73 Mon Sep 17 00:00:00 2001 From: esoe Date: Sun, 16 Oct 2022 21:35:59 +0300 Subject: [PATCH] ready to use --- universaty/src/main/java/ru/molokoin/App.java | 27 ------- .../src/main/java/ru/molokoin/Aspirant.java | 24 ------- .../src/main/java/ru/molokoin/Gender.java | 16 +++++ .../src/main/java/ru/molokoin/Person.java | 68 +++++++++++++----- .../src/main/java/ru/molokoin/Student.java | 5 -- .../src/main/java/ru/molokoin/Teacher.java | 10 --- .../target/classes/ru/molokoin/App.class | Bin 1128 -> 0 bytes .../target/classes/ru/molokoin/Aspirant.class | Bin 1023 -> 0 bytes .../target/classes/ru/molokoin/Gender$1.class | Bin 502 -> 586 bytes .../target/classes/ru/molokoin/Gender$2.class | Bin 503 -> 587 bytes .../target/classes/ru/molokoin/Gender$3.class | Bin 502 -> 586 bytes .../target/classes/ru/molokoin/Gender.class | Bin 1284 -> 1308 bytes .../target/classes/ru/molokoin/Person.class | Bin 4431 -> 5733 bytes .../target/classes/ru/molokoin/Student.class | Bin 624 -> 0 bytes .../target/classes/ru/molokoin/Teacher.class | Bin 636 -> 0 bytes 15 files changed, 65 insertions(+), 85 deletions(-) delete mode 100644 universaty/src/main/java/ru/molokoin/App.java delete mode 100644 universaty/src/main/java/ru/molokoin/Aspirant.java delete mode 100644 universaty/src/main/java/ru/molokoin/Student.java delete mode 100644 universaty/src/main/java/ru/molokoin/Teacher.java delete mode 100644 universaty/target/classes/ru/molokoin/App.class delete mode 100644 universaty/target/classes/ru/molokoin/Aspirant.class delete mode 100644 universaty/target/classes/ru/molokoin/Student.class delete mode 100644 universaty/target/classes/ru/molokoin/Teacher.class 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 5eb53cd18f0d27d14302659cce713ebf93ba3a79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1128 zcmZ`&Yi|-k6g>l!1xjC(KCQa-NwF4dtuKrTsgEyIjWkV6KTVe@ox04f!><2JBWa?k zKfoVlytAwp3TCr2vvbcq=f3vW@9#eWY~rbf1jCdLD{as9K6+ABYQAqF#V~!sKl6&q zRjcy$@I*KPLnaX1ITpIZFn>_*ciQV2s)XqTVNs4+Ej?jw6L~LE`td7zifg18N^`5FrCEkSXL!tNhp(`lYy613rpKEEpYBbV*biP=n7(v4nG1Od_%Gu^p(cF~|h7*X! zgXF+0M{kZX9McEl@b(#TMB8zyC}Qje4LA0&}5^FpVD8H#A9#?zjnmxhgS6Lk7S zHb(na`4p4ou`^6}Q7EU+Q0!v9oI1l|7t7^uSWf=H;)lY@S6nIFDBLKqY|qe$xt(ci};*2!+fNCJ1UK|4bQ_hR{N`c9a;bFy>z zl&eq%3@g!qhazl?$me9z{NP=9b>9p6^;V=r&_85YRx-h6{m)28SnjCni$Fxj3`=gM zL&i^KkLR(9H4_Df^{YNM){!H>M(gzDS>vRg2W7Qk#>%y(2>8i(c+OSZJ5O@TuIG0= zC1N>MW{=X0uiSaM&Dn%6c+lhOaDmlanU#)-YeZoRJX1=l9Ii9GdmShqO8 zgzrT{2F^%HVl{l?So!vV6BLAz8h0b9oTR;O(!&EMA#&g(a>Ws$GbU>9sotJtp@f?@ zcCg2=v!Ep1)@UF?hT^62Cex)k6ha;mhsh-4uHLp`AWKmH5=0x~R^~fGlN)-17NY3B zokukVPxXny)&iKpYRR$c^5-I++UkVZ!?>F$6PYF2&=h+ez#yy-UR%)=slg`@{` z$DjEH_E&6tre_9QbY?YRU|VbGpk5VIr^gi9AdU44r8k?qKXBuZwwn6ow4beGSh$6K z!WkUwr4f!bG0IY{eMfnk)gnD;kqs1dgrb(SX@rRP74s^3ulbcM*q i3=ty@lgB;WPn~O;7?GQDNGdPQI5KLJs|_nUeDy!e$=I_1 diff --git a/universaty/target/classes/ru/molokoin/Gender$1.class b/universaty/target/classes/ru/molokoin/Gender$1.class index d1612255543da1c12bce90d522c543ff234fbdd4..c1bb83f40ae40e5e5a7c31b48cf0152deded2a71 100644 GIT binary patch delta 132 zcmeyye2RtZ)W2Q(7#J7~8KgFHu``PErl*z!6y@jTm*)AG=W#HIGBPk{WEM~6XLM&| zo*d3tqru1^%pkzP$iNQNr3<7Pfi$y_$Oa(A#J~+C*}y`4lMgV8DvE(c#Tg`kGz$YW Okdy>sE~qvJ2L=Eth!Y+F delta 65 zcmX@b@{O76)W2Q(7#J7~8N@eou`^EAVsvF>nq0tGqs+`83>0T#5MdAn(ku+jKvE2d MxfmFM5C|L?0N!p1Z~y=R diff --git a/universaty/target/classes/ru/molokoin/Gender$2.class b/universaty/target/classes/ru/molokoin/Gender$2.class index 46145ad88a4c8dfc6ccbe647496a8bf33e5922ae..a43f53111b26f6e650d2b1256442411d00d356e4 100644 GIT binary patch delta 144 zcmey)e42&p)W2Q(7#J7~8KgFHaWIPWrl*z!6y@jTm*)AG=W#HIGBPk{q!vvUV033> zo*cob%P2UxjnRrxc=AC;VGTwGVFm#PMh14E3A#X<5lAx&iEIE;ObpyWk_{{*4pc0v ZCnq0uB%P2T`9;21HFar-zmWP26NHR0< hGVpff$?3=9m03=SK)mNWA4rl*z!6y@jTm*)AG=S^PEs4Az=V93s3z{ntw zl~|UjpOcuEt{+@kT#}m0!(hZ%+nX_008KfAbC!b>u z=3`-G&}PsA+Q7-6!=O7^okf{ZZ?ZRwtfUEpDFY(|FHlB{feFZBVBivB)Y`#dHo1{S tQQQ(Lr_R94zyg$G*V2~R&R{ipCyR`rHIUE5V8dVwrtKK)CqHA60|5VUDChtH delta 186 zcmbQk)xyPf>ff$?3=9m04E7tjmNQO1$fzu*$6&zDpwGx4kd;`LsGpOVm#!aNSzMBu z%L7zqG?|I1h|P?L!I;5(auw4TMz+cM%vr2F3{nh&lkYJHvoUZoXfxJ(CbrL9oR7q=8$udUbdOGPh<28HI$_Ex(sZ+k;+>-#r517(E< z&n`GbbWcv@%D(FjEmuekIo_b-E9})>OSsCs<$TkiGh+MYg5wF1U(6e#+NB%#jtgg( zhnT}DoBr)g=`3@hZ(sr7+LR%Vf23$MumbWR)DwXXauHAErgq*w-g#*QkUlPuv zUC%8aqp+@Jx+hbhq56Nb$_Q`WNVhtQgH99bvA4#aSfEhf(z>w;3X3!rV;_ZN$tm}k z7|xF|9jx6?V}E268o4&GudsJZoUCB|%QRjt+;h0Tb0WrK^_3b2;-J8)XjGupX%QFU z^SWKn>8TX@9ly`+4^mScu=5*j-<99t%ZBo>TZ*P4C>h50v>2DBnEM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#bXR%L_F~|237}8GPGlzr@hY5QPp=hA!GG5>r{#*6ft#=&HLnbQewL)wHJQnp1MOgf}q( zAwtK^f@Q1jOk`6Rt}txFc$i9EWjKfj+-hX7J)qN$3lKE=PPtbihS2v-giWyHrjL?>$49-XOS_B%Y591d`8p@vj+@vhd!wLJ~)1t!on3GG1(ziX7m)=IzKG=7RQd5a3wphvAcaBkC|dh#$mfki5@+e@;ZXCV^97$HNzL+E!$ zqw9N0{+NAq5fry0+UuU{8tf_i?KIgLZvRep#cv-Vdx`8Pd#Zj*BWsyQTG7Ft<9=Hw zJIC!cvQPMJlk7aV!?A&0toVJ4eA|6Gwxt)R{9b{)B9Fc1#h&*2hsiH-|F4)d^cK!E z_BT#XZ-3i{zeVZ(!HHa4ad&oi51qxiCUDsgpXKn|O*2>g@C6RPgLj)`uKM9i9Dc89 z=Hq_&GKXE9Z<6_hAHK@r3r#bx_~BI!U&Q-OGN1Cp*FCs;scGiZe)z_{CZL08T;C8r zz=w@WCf)Q_I;6huaXHbt^#<5T{}Xrc(a9E}e`Ia-zklwZ_5i)vfG-fhmk_t%Cbh#? r^yd1S-c&cKsc!K~ay=V9#wP>^sL@ub@w^s{;Tk^WEq9%q7JT+U>^dlI diff --git a/universaty/target/classes/ru/molokoin/Student.class b/universaty/target/classes/ru/molokoin/Student.class deleted file mode 100644 index e41a98cd26c037c2fe0ce34c271941d4ffa3f032..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 624 zcmZ8e%We}f6g^HtCK(0_Neh&xyK1^=REbqvv4J8Xg$j|h5=(c+Ep9z_p1f5p%oY#b8#wJl^9w{a&y#&GYZCc|B{8Itkj;LYCt zqzmF?xD|U#BW2`%D37F@h@;t-HW&I(I2G6PW_!2ZFu@8*PQ|$xYGF=>d(K(c!9#{G z2gb?D>T_A}+?G?Ng;&<_sk7u#Zu7MJuAFL>E6=Mim5x}Z@-F1wIzGGgV1uiQ2UEyn zI#j`r387j9?HAdb{C%i=M2N+O;qqc`ykME8SjK9GJ{~iy3`YOXJoZkRlbt#@|5;T8 z{}=N7X(;D(Y=g_?TNPu;=Kam+gf)t=Nsr608grzofesQH3|(5S(;UC#3h6bLE~#wb wKKmT!gehdq!qR8^hroaiAkS?m^6gy12G1W#Fr+^GKJA)rkUOC|FV5( zqKUryql|Yy5=z@mc4qE5=gz(N%-?@Me*<_6ZXw4|Gf`)yef?ca)tLy_TMA>Lz)-zQ zd=@6qilJb%FNho7B}asH8A?6Rmr9238S>56l*D~K7iDbWsRf7O+5H>`+bA+vlfh~K z<6u+vC2>?@hMu(gqgUrw50Z2f9e_;#~E1cWd*y<;Wzin?f9-*bjG2PYSG>3 z@q=2KkFLy4JtqAn8OaO#e^uJ tnjo}LhtIR56S}fMi2V!ouhqRvImsP1USpqlhJ!?P_#YUSmuCO~