From dbe4b8119cf5da2994ffed9d5959fdd7eb5e130b Mon Sep 17 00:00:00 2001 From: xivihwa <122834118+xivihwa@users.noreply.github.com> Date: Thu, 18 May 2023 02:37:48 +0300 Subject: [PATCH] lab4 --- .idea/.gitignore | 8 ++ .idea/OOP_IO-2x_2023.iml | 9 ++ .idea/misc.xml | 6 ++ .idea/modules.xml | 11 +++ .idea/vcs.xml | 6 ++ lab1/lab1.iml | 11 +++ lab2/lab2.iml | 11 +++ lab3/lab3.iml | 11 +++ lab4/EducationalInstitution/.idea/.gitignore | 8 ++ lab4/EducationalInstitution/.idea/misc.xml | 6 ++ lab4/EducationalInstitution/.idea/modules.xml | 8 ++ .../EducationalInstitution.iml | 11 +++ .../EducationalInstitution.class | Bin 0 -> 1837 bytes .../EducationalInstitution/Main.class | Bin 0 -> 2945 bytes lab4/EducationalInstitution/src/Main.java | 0 lab4/untitled/.idea/.gitignore | 8 ++ lab4/untitled/.idea/misc.xml | 6 ++ lab4/untitled/.idea/modules.xml | 8 ++ .../out/production/untitled/Main.class | Bin 0 -> 3623 bytes .../out/production/untitled/SeaShip.class | Bin 0 -> 2783 bytes lab4/untitled/src/Main.java | 56 ++++++++++++ lab4/untitled/src/SeaShip.java | 86 ++++++++++++++++++ lab4/untitled/untitled.iml | 11 +++ 23 files changed, 281 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/OOP_IO-2x_2023.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 lab1/lab1.iml create mode 100644 lab2/lab2.iml create mode 100644 lab3/lab3.iml create mode 100644 lab4/EducationalInstitution/.idea/.gitignore create mode 100644 lab4/EducationalInstitution/.idea/misc.xml create mode 100644 lab4/EducationalInstitution/.idea/modules.xml create mode 100644 lab4/EducationalInstitution/EducationalInstitution.iml create mode 100644 lab4/EducationalInstitution/out/production/EducationalInstitution/EducationalInstitution.class create mode 100644 lab4/EducationalInstitution/out/production/EducationalInstitution/Main.class create mode 100644 lab4/EducationalInstitution/src/Main.java create mode 100644 lab4/untitled/.idea/.gitignore create mode 100644 lab4/untitled/.idea/misc.xml create mode 100644 lab4/untitled/.idea/modules.xml create mode 100644 lab4/untitled/out/production/untitled/Main.class create mode 100644 lab4/untitled/out/production/untitled/SeaShip.class create mode 100644 lab4/untitled/src/Main.java create mode 100644 lab4/untitled/src/SeaShip.java create mode 100644 lab4/untitled/untitled.iml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/OOP_IO-2x_2023.iml b/.idea/OOP_IO-2x_2023.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/OOP_IO-2x_2023.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..21f8297 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lab1/lab1.iml b/lab1/lab1.iml new file mode 100644 index 0000000..684c1d6 --- /dev/null +++ b/lab1/lab1.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lab2/lab2.iml b/lab2/lab2.iml new file mode 100644 index 0000000..d536c2e --- /dev/null +++ b/lab2/lab2.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lab3/lab3.iml b/lab3/lab3.iml new file mode 100644 index 0000000..48a36c2 --- /dev/null +++ b/lab3/lab3.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lab4/EducationalInstitution/.idea/.gitignore b/lab4/EducationalInstitution/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/lab4/EducationalInstitution/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/lab4/EducationalInstitution/.idea/misc.xml b/lab4/EducationalInstitution/.idea/misc.xml new file mode 100644 index 0000000..7464918 --- /dev/null +++ b/lab4/EducationalInstitution/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lab4/EducationalInstitution/.idea/modules.xml b/lab4/EducationalInstitution/.idea/modules.xml new file mode 100644 index 0000000..6eb3842 --- /dev/null +++ b/lab4/EducationalInstitution/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/lab4/EducationalInstitution/EducationalInstitution.iml b/lab4/EducationalInstitution/EducationalInstitution.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/lab4/EducationalInstitution/EducationalInstitution.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lab4/EducationalInstitution/out/production/EducationalInstitution/EducationalInstitution.class b/lab4/EducationalInstitution/out/production/EducationalInstitution/EducationalInstitution.class new file mode 100644 index 0000000000000000000000000000000000000000..629ed249f6989e176b9526158bd4d3e37122738d GIT binary patch literal 1837 zcma)6TTc@~6#fRy3euKKz2c=@gesv)0RseMd~s+OSXg$+?v#WW|Ai0! z2p=@D(eU68@JAWXOskab#`rKZXU@#|=A84*IX{10`~a|o=TWqvRYOQe7!iip5kKQu zi`xg;&AlU|Bp4#|rfrHvhSpSiw;gS0*AUfl4LU>ri*lvJh3V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6!Ont;Kdb9m*XF4rsf4hn;(>CrK=-2<>qT}-Jd);ft4#aia zrX`cngsHby;Z1>+#TiYzR*F9Rt)VdM_qGoQFzCmtNL3+4!>}}*@S_h@vp<|l>FKtl zmdWTD1*Zg7%&PC5N~Pdkfu(ncO4-|W#WH#<;S~#b*z5cwh0hl`Yvx<LirT(rbJK%Y*X*N@F0q);o!c&eC9I zw9^v|M6X~02R5Q6xHzC}2(*0cBJPoh`y7PVMl2211r&ck`_@G)mxy`?QD!3^3^oLm z4+6XETtuTpG&u;xMyv_04JhG2`(78ZP9iqgh{&o5Yy`&9GKOuz_RH9{s-r2lrF5gG z+Oy;5BCA>zEhjkMw;?UvcsymVu$3gUv^8%lTkl=Y7=4?4U zxA7Ca3VIbJ`Csr9|3d98EVd^cR{5mrob%(Sv&0sKZ`Eb&YveEf9a)MMVA^riI4DM| za~<$8b{&FTl=Mt4^6V$y{#jhTcjIEE(zfpm>j6lQS=!#fTNrXj$2mG_dlwkNJ9rPZ Fe*^ij7R3Mn literal 0 HcmV?d00001 diff --git a/lab4/EducationalInstitution/src/Main.java b/lab4/EducationalInstitution/src/Main.java new file mode 100644 index 0000000..e69de29 diff --git a/lab4/untitled/.idea/.gitignore b/lab4/untitled/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/lab4/untitled/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/lab4/untitled/.idea/misc.xml b/lab4/untitled/.idea/misc.xml new file mode 100644 index 0000000..7464918 --- /dev/null +++ b/lab4/untitled/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lab4/untitled/.idea/modules.xml b/lab4/untitled/.idea/modules.xml new file mode 100644 index 0000000..3007dae --- /dev/null +++ b/lab4/untitled/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/lab4/untitled/out/production/untitled/Main.class b/lab4/untitled/out/production/untitled/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..8e640c2d00b28d2056dc8fc7af136d417f67471f GIT binary patch literal 3623 zcmcInX?q*h6@IU*cp&y{{of+9zw&QQr^JtcP_H*8I?wx;qu<|~D zyYWvO8MIi)I@pF*f!rmzAVg6*IKjzD%? zdcJ_|hDt`N=+(%-b6~I-YpF+GdF0+Ol#7~B(4spWbRs9vUJX4zO8C164EC5aF_U-D zjUIuvS`enJ2RE{=mu*KMc3RlwU^n(O#Zy|WMXJIuf;zqIO$5DQpr1xWmDn_=G^$8al|MW>rXu1zE1E zvoivH&2~}_*1aDm9GnCpWNY=Og8Ech#dtc^de0`KQ@GEIaTjV#2D zH{^N;PMPr}%QQ2HF^%F+3p~9^&XanZ8Q5~A;l06>8ZuU{&!i!I2t^0uIKxQg^z=F; zB;8dQd?=3=oOAFQJSebDR;%SjfqhLaG*kE8$P4_D)9FK@1LyHs3lk15;Bx{!Ywb1~ zRH`zRQNYTyyYUMFCvcnDIU5z49lNF?w)2pKhw*u~VW<{VSW^sSSCe}Ne;!$!)6RX# z!A0%a_GnJ|2?O2ez!Y2y(+(7fmmO8qh#=X4I9g-Z_RQEtF7?vNy% z1pAIqJyQ2Vbtdr7)XQY*H?h#jx>3V)DNp414gyp;@ucgjDm^)#$~Jd*!OYfbE_K7z zD=K8trVu))feNgdAiPhya{~L#pf(B(PO#%fgK4%!XVLT3nR;bPh3945DEVUG%JPH^ zJ^h|8W}`We@wOKA2rf{%5|84(frpLYR_6`rGMpuU_a94x*QjrIxnP7#4|EwOqAZwT9sApa4`tx>(xS%i|dTiCc*QB%O>n5 z1~+NRRK=()mrGuxxGVpH5cOq6i8j1U?6_rFtMU0&E=M#W81ye~ypCU4__c#K@Fp>^ zA?Tv4OifEhBxf2ScT~)`fB*jzuw{0dh)K@PTU6N4t|e6 z5I3_bDk^_A;ymhUw1}~_7IOHLz>Nc|jcn>qcR%WUTkCws!Mj>#2X&6i%cZJP(>c6% zon3B%VoUnqbVZ+<-pk>tfMeJp!ksbSSK+9xtg2b~o50N*D!3UMExgbE*_u_4$r!pc z-o_)3{%zy=heuvs>wFvGUFg-JD-iGSA%g{8H5uHXzs#$XFyJy4`PPm{@fEIU;fUN? z>7Hd+#o=Xa=fA7?E_(AfEa67Ipf$F{8uw7AHlBs0kJ8xAgLE&iyRjp-(wAt$SMeD6 zvOLW`jwfj6Nxo?hl9i|UWa}e1xwQu$QbP;xk6y!}$t$?|fotgJeW2KKa&OLl9q!OI z3{LLNUR=R25Z_1A`>num*Dbjve6*|OKNpvA+wc+!J-B zlM!!y`0~)(w4RM4>}OO!7o*D~haT)=e0MUA3G9T==a6fci6EWR{q#DI8GH>-Gm+6W&*2ijj&B%oC$witdyfB3WIjON!XXR&;=epje3OeAe2YopH$$3~$9UIeIk1AW zz%oi#F)6TuF928Z#SDr=!&f0Qh<#70qYp6P(9Gi~{k|3ZaLlO60eqXa04eSG4!)au zmsCvCo?4}SkF><4@6#oI@}w@EXS^CwJwrst#FU8ka@EW<^!f)`$^y$y((_ipc Rrf7w7Hf65i@AwCH{|{3uwu1lw literal 0 HcmV?d00001 diff --git a/lab4/untitled/out/production/untitled/SeaShip.class b/lab4/untitled/out/production/untitled/SeaShip.class new file mode 100644 index 0000000000000000000000000000000000000000..751a9093515cd84874abd91377f41fd648e9544d GIT binary patch literal 2783 zcmc(hQBNC35Xb*(Y@cn;!NGv*It4d@0LH;>lQwNkA&m(MjUhCS$U~nFv$8LkJIi+@ z&2zs(ANny`saB<^>IdkDsyefG#OKSoQlBccx3kOa%x`9A2mbo|?VkX4@LdKmOlgSg zNFXVYduhBfYCXg1)SjNalxeTtj6&*9IpLR&O(K8%}cdzQ0<=wdZrZ0J8PRBeJ$mMHkcDm#{A27FX zxw0b%%H9V$iujNed(!H--EqIW_Qgq0D!pquK4OE3zWrJb*u|2LGM`MH8$Y!AQl8FI z9H(@np2>QqJ@=^m>3 znOlpDQ*$mA<|86rCkCBNa3!kZq9q*&EZMvj&v4+ zo-b9{H5+RBbvVxN->+xqQe`XxUxUr0$jlL!DT(CP7pH0Wz%NySY5K)zm2z#b5(F|W z`(n_RdnTt{_cOc6Z;{^g1KV~TcVP4nq}#PmotY$dGkAzS4Uf3;9}6sxo~>!Uvd?7A zv+O;FJ)`Z~gEs;{2Xo*ndPW}`)@e^V%T3!pyXe>7FV?`$*g?LG2=(s+`d%lh2P?xj z(J*?wmg&lR3f~Gmqqxi5ValswwOVd-pSf2S)iU=N5;im5eUq5+ZiA(VR)^}gtU3g* zDZgchI|DB$nfsO{2db>3qv1ec<-J@*r9i_|fyIAUr3U8Z3m;Q!icu%h=u4fIq!@Qh zHB*mNGqpxFQ|D7Nbv89qKchJZYI9hj?@e0$LFZF6S1Z3mR5pgtD%Byfm0LsPD#iE^ z`ARV{M4?hl4pFKUwILRNRn}JNdlPB;>WCvt(iQrdL7qGmaTQC{vsY-ffjO*^)-%r! z)={Aqc~tyDNgM%3Rpma9DJ5|faV2pa2_y^A?Tihk05Xho3z7e*d}cTNU9W!0_4AXK#AO6Qx+CHt#?5r{U8Ktks#SH$WkQ8 zC($6;Fvtx8S)KsGIphp{8VQmMgRDk^d=?Fo3xjMBNOb}TUm=6s#vS@{c7s=w4};Vq zK|aS9{^7B!$%jF16UdzjAY4HVau;7lfE2UmPU?7o<@O2iN@kv>VF7R9t9|``!90}_o?n;_y!MXPLZbujeR_!RfeP{ I4snFyKRt&5U;qFB literal 0 HcmV?d00001 diff --git a/lab4/untitled/src/Main.java b/lab4/untitled/src/Main.java new file mode 100644 index 0000000..8ecc5af --- /dev/null +++ b/lab4/untitled/src/Main.java @@ -0,0 +1,56 @@ +import java.util.*; + +public class Main { + public static void main(String[] args) { + List ships = createList(); + + printList(ships); + + ships = sortList(ships); + + System.out.println("=============================="); + + printList(ships); + } + + private static ArrayList createList() { + ArrayList ships = new ArrayList<>(); + Random random = new Random(); + + for (int i = 0; i < 10; i++) + ships.add(new SeaShip("name" + (i + 1), "class" + (i + 1), "type" + (i + 1), + random.nextInt(10000) + 1000, random.nextDouble() * 100 + 20, + random.nextInt(10000) + 1000, random.nextDouble() * 100)); + +// ships.add(new SeaShip("nameA", "classA", "typeA", +// random.nextInt(10000) + 1000, 100d, +// random.nextInt(10000) + 1000, 120d)); +// ships.add(new SeaShip("nameA", "classA", "typeA", +// random.nextInt(10000) + 1000, 100d, +// random.nextInt(10000) + 1000, 130d)); +// ships.add(new SeaShip("nameA", "classA", "typeA", +// random.nextInt(10000) + 1000, 100d, +// random.nextInt(10000) + 1000, 140d)); +// ships.add(new SeaShip("nameA", "classA", "typeA", +// random.nextInt(10000) + 1000, 120d, +// random.nextInt(10000) + 1000, 120d)); +// ships.add(new SeaShip("nameA", "classA", "typeA", +// random.nextInt(10000) + 1000, 120d, +// random.nextInt(10000) + 1000, 100d)); + + return ships; + } + + private static List sortList(List list) { + Comparator comparator = Comparator.comparing(SeaShip::getLength).reversed() + .thenComparing(SeaShip::getMaxSpeed); + + list.sort(comparator); + + return list; + } + + private static void printList(List list) { + list.forEach(System.out::println); + } +} diff --git a/lab4/untitled/src/SeaShip.java b/lab4/untitled/src/SeaShip.java new file mode 100644 index 0000000..8ebf9cd --- /dev/null +++ b/lab4/untitled/src/SeaShip.java @@ -0,0 +1,86 @@ + +public class SeaShip { + private String name; + private String shipClass; + private String type; + private Integer weight; + private Double length; + private Integer power; + private Double maxSpeed; + + public SeaShip(String name, String shipClass, String type, + Integer weight, Double length, Integer power, Double maxSpeed) { + this.name = name; + this.shipClass = shipClass; + this.type = type; + this.weight = weight; + this.length = length; + this.power = power; + this.maxSpeed = maxSpeed; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getShipClass() { + return shipClass; + } + + public void setShipClass(String shipClass) { + this.shipClass = shipClass; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getWeight() { + return weight; + } + + public void setWeight(Integer weight) { + this.weight = weight; + } + + public Double getLength() { + return length; + } + + public void setLength(Double length) { + this.length = length; + } + + public Integer getPower() { + return power; + } + + public void setPower(Integer power) { + this.power = power; + } + + public Double getMaxSpeed() { + return maxSpeed; + } + + public void setMaxSpeed(Double maxSpeed) { + this.maxSpeed = maxSpeed; + } + + @Override + public String toString() { + return "Sea ship '" + name + "', class: " + shipClass + ", type: " + type + ".\n" + + "Weight: " + weight + "\n" + + "Length: " + length + "\n" + + "Engine power: " + power + "\n" + + "Max speed: " + maxSpeed + "\n"; + } +} \ No newline at end of file diff --git a/lab4/untitled/untitled.iml b/lab4/untitled/untitled.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/lab4/untitled/untitled.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file