From 154398a0136e992e2513b9c4511ee56f111b8377 Mon Sep 17 00:00:00 2001
From: dima0808 <52035263+dima0808@users.noreply.github.com>
Date: Fri, 31 Mar 2023 18:24:41 +0200
Subject: [PATCH] Add files via upload
---
lab7/lab7.iml | 11 ++
lab7/out/production/lab7/lab7/Car.class | Bin 0 -> 1962 bytes
.../production/lab7/lab7/CarCollection.class | Bin 0 -> 5158 bytes
.../out/production/lab7/lab7/CombatsCar.class | Bin 0 -> 1706 bytes
.../production/lab7/lab7/ElectricCar.class | Bin 0 -> 1552 bytes
lab7/out/production/lab7/lab7/Main.class | Bin 0 -> 4797 bytes
lab7/out/production/lab7/lab7/SportsCar.class | Bin 0 -> 1669 bytes
lab7/src/lab7/Car.java | 42 ++++++
lab7/src/lab7/CarCollection.java | 137 ++++++++++++++++++
lab7/src/lab7/CombatsCar.java | 29 ++++
lab7/src/lab7/ElectricCar.java | 25 ++++
lab7/src/lab7/Main.java | 73 ++++++++++
lab7/src/lab7/SportsCar.java | 28 ++++
13 files changed, 345 insertions(+)
create mode 100644 lab7/lab7.iml
create mode 100644 lab7/out/production/lab7/lab7/Car.class
create mode 100644 lab7/out/production/lab7/lab7/CarCollection.class
create mode 100644 lab7/out/production/lab7/lab7/CombatsCar.class
create mode 100644 lab7/out/production/lab7/lab7/ElectricCar.class
create mode 100644 lab7/out/production/lab7/lab7/Main.class
create mode 100644 lab7/out/production/lab7/lab7/SportsCar.class
create mode 100644 lab7/src/lab7/Car.java
create mode 100644 lab7/src/lab7/CarCollection.java
create mode 100644 lab7/src/lab7/CombatsCar.java
create mode 100644 lab7/src/lab7/ElectricCar.java
create mode 100644 lab7/src/lab7/Main.java
create mode 100644 lab7/src/lab7/SportsCar.java
diff --git a/lab7/lab7.iml b/lab7/lab7.iml
new file mode 100644
index 0000000..9465dd8
--- /dev/null
+++ b/lab7/lab7.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab7/out/production/lab7/lab7/Car.class b/lab7/out/production/lab7/lab7/Car.class
new file mode 100644
index 0000000000000000000000000000000000000000..c2aec9bd31dc7d9e0b347c44ef68842b91219c65
GIT binary patch
literal 1962
zcma)7-*XyO6#j02K*$CNEzmY3O)6;ui6zl$wbWXRVo};uiPRaNZpgLSX4%awOUH~a
zPM`bagX4qGKF3ap8KU*wr{y2&^xR##kY>kmm^t^}v**WmzI)E)-Wr;|z&M{4pH*m@+I7Q^@rRadQ>41wi*BZ>$n!iXxEgu)Qf_|~;znVSp~
zZDBRI))8%n!g6gGr*4_5{;+gfQ>|9qfH4^@&XE6~Zu!Op!I)N%#2JQQi<`R)$
zRZ2lxT7_E1w$P;JoPzVXK$<;MZ3+ffmD;R=S*Z=~3vNoqMFsO%AjS6`p^;T(0&gJ~
z#-f7DSUSN}eZOsq77=80h_93jL^X={sc?(R7ra$U65V+P1*|Y+T6|ZO4ZX>&2dcG0
zySBx3i-^1I!$AIYVNtw|D`6BBtYMwuj6?RxgbZP-Pq#Fk5cx%IB*E~mM0Ay5$;YDV
zlQ>D;^1k%BCZqaW1n{A>xGpU!J~4>WGTjA3yr$~nUZ=Gs%uT+fktSI)np|seQ
zMFpRSaYtgTGUSGhs_Ku8T~T!V)xDkyZ(4@A&+zLgK?6fK=pC+aYoeX28OCmB&!^2t
zuJ457=Kh}WG5>DFe#05T(kO|85M{1ub=4B32)<;PvVXG=`ajt{`{4RKi{LK9G^t+L
z&+V>#+|g
z^|dvM{1-V_bzPWcjknvP9mXcZ;wkq0NC~6CF!$f4^v<{pVu6NljHV@opd4`81?31k
zD-Eu*(x^HsO(?A)>f{g7^feQDEtXlSXrG-1v8;Tg#RGj7;cb^AwY7H;wp$^
zik?B>rt3rN$8;iZCpU9;GP^{SkPnCBn~;wM`AeO|;39|*5bV%7MBidV1c#Vs!R{>jU4BC_`o^72{=bU7jcRH7S^$ZTNG9jDBF>e4FCsdC)@8f
g%CySX`INqY;mDdJ?>X{5zNYU{`c}s`c!2Y-07Q+Og8%>k
literal 0
HcmV?d00001
diff --git a/lab7/out/production/lab7/lab7/CarCollection.class b/lab7/out/production/lab7/lab7/CarCollection.class
new file mode 100644
index 0000000000000000000000000000000000000000..8174d55dd8cd36d041da8290d5272342b38d53ca
GIT binary patch
literal 5158
zcmb_gTXz#x6yDQYnsi#)(gG#LBB&&3rB(%mmP#qD1S?gD#TG@U>Cg_O2~JXO-T)Cr
z#rys4yAQgSmbG*(m(Ttvm*1Xq=91Hyf-E1JOwQT+`}Y3M-sha@-~asnClT$X9}`qV
zwK1yGsh%1%YCUC~HTnxialU_Y_LP~gXw)!d6|Ks!MzyK*RE!!m>TryfDpsL?!YZCN
z=O(OjB|$N&jZ+ipF>2PSh1O`)UNB~N^^Y3%XsJ*Dm{lrj6w4bnJ7~0SA`EDdk=k@>
zr?ucT=H@i&ObN?CT!ZNuw(I1$*J;!xEu5fyw!!oiTW!#(i#BRhSGF#iP9j+z?$&7&
z-Gzv(^4Q{;$^~b}f!(ar-Avz@FBL0>RV=glR-NvldogHLOxviGY-Es12Xe^DaVLXq
zI;AKL@JeaKwhe%Hrqah(=E2ClY}=<%DivZ7<+NR=evYxhHWy20O~x6}=|Or(qb4`(
zkwRe=ZJbnh=(Ll48lW`H8Riil+O5&XR5p-ZP*ulsP^TgGjEexI^RP~j%28HMj*jTG
zpX;kWUoZ`uNe<{VM&pot-b5*Mrm|AW;2Ov1Amnz7h`kQ!^f*nxtIS^8+yH}4Avo-L
zm@8_MmrN#A<>QpeQ>^GX8z0pvM^AHQ6z9zIlP4oe(5a$hIz7X-O$DP|$qIYMn9=Dt
zJ*$ykK(V`}!J^6lW&ikdPT8Dbuje&NdV+-889L2U9ubz8W<@u3q_VDto(mwG$mFz;
zLNi0UVmdPmtcj&j3pDX2xMiB?Gz*R5Szk5fTd_@%m+&M%onfFCnZmb7&%~$<>|l>`
z*T;`q^F^bwWTO+4f%@{dlA&B~aCi{yI$D~8(HhK{hnE&-O*?1I7BJF2QOX;IDZ{q-
zw;ZgiELh;{@FEBl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#1Zw1h
zhG*!y>v}D(X*NEU-j=)3nu+4Q7%rn|;EHbGRe^=0N-XELyDbOm?Dw>6);zaKmHjl_
zut8!Ubj5TwY}s0)l
z7x+Z|qW+}J9tRqHpq{8F{{81Q*kQOsH9qop{U0xpKC
z=Tt6#{&X_jg~+8M9T>S}^xF=m9`aWRS&j*WIZp745oi+g1j{k9(qE1|&eJ0hmT-aK
z+A7e}MWnEdizL?88?-c1Dkv)wSTl@8x#ms0H7KjVSz|>`;RZg&$$tTpuBqn$
literal 0
HcmV?d00001
diff --git a/lab7/out/production/lab7/lab7/Main.class b/lab7/out/production/lab7/lab7/Main.class
new file mode 100644
index 0000000000000000000000000000000000000000..8523948d3e24500d4c36199479b7552b092d7ef3
GIT binary patch
literal 4797
zcma)A3w%@68ULU3HupBY(B$weA_nErQfeuMfh}OuU?rMXv{(ji>TP=4M$+7v2U<2+
z1*dFt;$*^nPMs6yoYo3yX{FTaHhk`8bDPs`KBmsS-E`AAwfoLZ`Un(%woP)+`M&d=
z@A3a0>C>O|4FFipDjcvOM~0*#7j_2cW!hG)ETn~7%g$@MOb^5v?5l#|V0;ZjPEm2A
z426M*w5AnhUM=c1LLuS_8es=yAts+;vPEo&7}0o)SQJcRkZbj5REq``6fiiJEnn&O
z#kEjS%R$bLh~%05>~oU$96+kR5pdA&G@;FOhSDPcm_7~hXfWJbb^MOcSL>^-Ep8M#
z%v4c`S){Ah+{`ek$UmZLRqcbZEYi?6wD#r)+M4^Kns&D@82bPW|A7-
z2BFJ+EiDS>5yN^T8Vj`P3Ko#uGs??zVDr5rd76dRX9~`0K*3_-tPA+Hs2)~uI)k))
z#gYaRI;mRnR8&+*UcX?CRa7Wg#-Ms)aU<-m)1vVp@qdmEH)`Ry)~ZXMwL-90aCZWE
zsKP24t5vMQnOX5^=!nJjc2dbmP?V;n{Sq|F){~p!J$
zSDOQ=&eRTb!0a}=%)_a@ZrVDM+3YjBQk`b6+w3vB+^K8nz+s}?;I<;Kf=QXQ`;g
z*$h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ITlDDY0FB?h>E
z*XMt0>8@yarT*6SAj;e{>xL(2F0WGu<)1Wt>;41z%-;w`^5H_BskL1>Q
z|2MgxCs!5ll#)|CrImXOdeyRoQ#QHl3RlA|hI2>iJg9sczGle%zbh@Gu+}(B8z4e2
zWC&@sUPwx-{SlnBF@irdN_dA}!n>sXg*b-k%oS!YOlG3l*mJN#CcXo$kkxiDTF54L
zFtJ4*5xhs=6BG+133~(+grCJICXvGXWc@xw!Uy<}G{VG1T%tTmx=fPdl~c=!*ePj&
zq-Y?Oh?&C81)Sr7q*!Z#q implements List {
+ private final LinkedList carList;
+
+ public CarCollection() {
+ carList = new LinkedList<>();
+ }
+
+ public CarCollection(T car) {
+ carList = new LinkedList<>();
+ carList.add(car);
+ }
+
+ public CarCollection(Collection extends T> c) {
+ carList = new LinkedList<>(c);
+ }
+
+ // Реалізація методів List
+ @Override
+ public int size() {
+ return carList.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return carList.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return carList.contains(o);
+ }
+
+ @Override
+ public Iterator iterator() {
+ return carList.iterator();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return carList.toArray();
+ }
+
+ @Override
+ public T1[] toArray(T1[] a) {
+ return carList.toArray(a);
+ }
+
+ @Override
+ public boolean add(T t) {
+ return carList.add(t);
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return carList.remove(o);
+ }
+
+ @Override
+ public boolean containsAll(Collection> c) {
+ return carList.containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(Collection extends T> c) {
+ return carList.addAll(c);
+ }
+
+ @Override
+ public boolean addAll(int index, Collection extends T> c) {
+ return carList.addAll(index, c);
+ }
+
+ @Override
+ public boolean removeAll(Collection> c) {
+ return carList.removeAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection> c) {
+ return carList.retainAll(c);
+ }
+
+ @Override
+ public void clear() {
+ carList.clear();
+ }
+
+ @Override
+ public T get(int index) {
+ return carList.get(index);
+ }
+
+ @Override
+ public T set(int index, T element) {
+ return carList.set(index, element);
+ }
+
+ @Override
+ public void add(int index, T element) {
+ carList.add(index, element);
+ }
+
+ @Override
+ public T remove(int index) {
+ return carList.remove(index);
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return carList.indexOf(o);
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return carList.lastIndexOf(o);
+ }
+
+ @Override
+ public ListIterator listIterator() {
+ return carList.listIterator();
+ }
+
+ @Override
+ public ListIterator listIterator(int index) {
+ return carList.listIterator(index);
+ }
+
+ @Override
+ public List subList(int fromIndex, int toIndex) {
+ return carList.subList(fromIndex, toIndex);
+ }
+
+}
\ No newline at end of file
diff --git a/lab7/src/lab7/CombatsCar.java b/lab7/src/lab7/CombatsCar.java
new file mode 100644
index 0000000..8a7eeae
--- /dev/null
+++ b/lab7/src/lab7/CombatsCar.java
@@ -0,0 +1,29 @@
+package lab7;
+
+public class CombatsCar extends Car {
+
+ private final int crew;
+ private final float weight;
+ private final String country;
+
+ public CombatsCar(String mark, String model, int price, int year, float fuel, int crew, float weight, String country) {
+ super(mark, model, price, year, fuel);
+ this.crew = crew;
+ this.weight = weight;
+ this.country = country;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void printValues() {
+ super.printValues();
+ System.out.println("--- Особливості бойової машини ---");
+ System.out.println("Екіпаж: " + crew + " людей");
+ System.out.println("Бойова маса: " + weight + "т");
+ System.out.println("Країна-виробник: " + country);
+
+ }
+
+}
diff --git a/lab7/src/lab7/ElectricCar.java b/lab7/src/lab7/ElectricCar.java
new file mode 100644
index 0000000..04012d9
--- /dev/null
+++ b/lab7/src/lab7/ElectricCar.java
@@ -0,0 +1,25 @@
+package lab7;
+
+public class ElectricCar extends Car {
+
+ private final float electricity;
+ private final float chargingSpeed;
+
+ public ElectricCar(String mark, String model, int price, int year, float electricity, int chargingSpeed) {
+ super(mark, model, price, year);
+ this.electricity = electricity;
+ this.chargingSpeed = chargingSpeed;
+ }
+
+ public float getElectricity() {
+ return electricity;
+ }
+
+ public void printValues() {
+ super.printValues();
+ System.out.println("-Особливості електрокару-");
+ System.out.println("Споживання електроенергії: " + electricity + " кВт·год/100км");
+ System.out.println("Швидкість зарядки (з 0% до 100%): " + chargingSpeed + " хв");
+ }
+
+}
diff --git a/lab7/src/lab7/Main.java b/lab7/src/lab7/Main.java
new file mode 100644
index 0000000..0681976
--- /dev/null
+++ b/lab7/src/lab7/Main.java
@@ -0,0 +1,73 @@
+package lab7;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+
+// Використання пустого конструктора CarCollection
+ CarCollection sportsCars = new CarCollection<>();
+ sportsCars.add(new SportsCar("Ferrari", "458 Italia", 230000, 2015, 9.8f, 562, 202, 4.5f));
+ sportsCars.add(new SportsCar("Lamborghini", "Huracan", 260000, 2020, 9.5f, 640, 211, 5.2f));
+ sportsCars.add(new SportsCar("Porsche", "911", 150000, 2018, 14.3f, 450, 191, 3.0f));
+ sportsCars.add(new SportsCar("McLaren", "570S", 200000, 2017, 11.2f, 562, 204, 3.8f));
+ sportsCars.add(new SportsCar("Aston Martin", "Vantage", 150000, 2021, 12.3f, 503, 195, 4.0f));
+
+// Сортування спорткарів за ціною
+ System.out.println("~~~~~ Відсортовані спорткари за ціною ~~~~~");
+ sportsCars.sort(Comparator.comparingInt(SportsCar::getPrice));
+
+ for (int i = sportsCars.size() - 1; i >= 0; i--) {
+ sportsCars.get(i).printValues();
+ System.out.println();
+ }
+
+// Використання конструктора CarCollection з передаванням в його лише один об'єкт
+ CarCollection combatsCars = new CarCollection<>(new CombatsCar("Humvee", "M1114", 220000, 1995, 6.5f, 4, 5.5f, "США"));
+ combatsCars.add(new CombatsCar("Puma", "IFV", 3500000, 2010, 10.7f, 6, 31f, "Німеччина"));
+ combatsCars.add(new CombatsCar("Warrior", "IFV", 4500000, 1988, 12.4f, 3, 29f, "Великобританія"));
+ combatsCars.add(new CombatsCar("ZBD", "05", 1200000, 2011, 9.4f, 4, 25f, "Китай"));
+ combatsCars.add(new CombatsCar("VBCI", "IFV", 5000000, 2008, 10.7f, 8, 32f, "Франція"));
+
+// Пошук бойової машини за країною-виробником
+ Scanner scanner = new Scanner(System.in);
+ System.out.print("Введіть країну-виробницю бойової машини: ");
+ String userCountry = scanner.nextLine();
+
+ System.out.println("Результати пошуку:\n");
+ for (CombatsCar car : combatsCars) {
+ if (car.getCountry().equals(userCountry)) {
+ car.printValues();
+ }
+ }
+
+ ArrayList electricCarsList = new ArrayList<>();
+ electricCarsList.add(new ElectricCar("Tesla", "Model S", 80000, 2022, 21.5f, 45));
+ electricCarsList.add(new ElectricCar("Chevrolet", "Bolt", 35000, 2021, 28.0f, 60));
+ electricCarsList.add(new ElectricCar("Nissan", "Leaf", 32000, 2021, 24.0f, 40));
+ electricCarsList.add(new ElectricCar("BMW", "i3", 45000, 2021, 19.5f, 30));
+ electricCarsList.add(new ElectricCar("Hyundai", "Kona", 42000, 2022, 22.0f, 50));
+
+// Використання конструктора CarCollection з передаванням в його колекцію об'єктів
+ CarCollection electricCars = new CarCollection<>(electricCarsList);
+
+// Пошук автомобіля по діапазону споживання електроенергії
+ System.out.println("\nВведіть діапазон споживання електроенергії (кВт·год/100км):");
+ System.out.print("від ");
+ float electricityLowerLimit = scanner.nextFloat();
+ System.out.print("до ");
+ float electricityUpperLimit = scanner.nextFloat();
+
+ System.out.println("Результати пошуку:\n");
+ for (ElectricCar car : electricCars) {
+ if (car.getElectricity() < electricityUpperLimit & car.getElectricity() > electricityLowerLimit) {
+ car.printValues();
+ }
+ }
+
+ }
+
+}
diff --git a/lab7/src/lab7/SportsCar.java b/lab7/src/lab7/SportsCar.java
new file mode 100644
index 0000000..6b77e1e
--- /dev/null
+++ b/lab7/src/lab7/SportsCar.java
@@ -0,0 +1,28 @@
+package lab7;
+
+public class SportsCar extends Car {
+
+ private final int power;
+ private final float speed;
+ private final float engineCapacity;
+
+ public SportsCar(String mark, String model, int price, int year, float fuel, int power, float speed, float engineCapacity) {
+ super(mark, model, price, year, fuel);
+ this.power = power;
+ this.speed = speed;
+ this.engineCapacity = engineCapacity;
+ }
+
+ public int getPrice() {
+ return price;
+ }
+
+ public void printValues() {
+ super.printValues();
+ System.out.println("-Особливості спорткару-");
+ System.out.println("Потужість: " + power + " кінських сил");
+ System.out.println("Максимальна швидкість: " + speed + " км/год");
+ System.out.println("Об'єм двигуна: " + engineCapacity + "л");
+ }
+
+}