diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7193838..c0d632f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -7,5 +7,5 @@
-
+
\ No newline at end of file
diff --git a/JavaCore2.iml b/JavaCore2.iml
index 6371e6f..1f1c1bc 100644
--- a/JavaCore2.iml
+++ b/JavaCore2.iml
@@ -24,6 +24,7 @@
+
diff --git a/geckodriver.exe b/geckodriver.exe
new file mode 100644
index 0000000..9fae8e0
Binary files /dev/null and b/geckodriver.exe differ
diff --git a/pom.xml b/pom.xml
index 40b246b..dba8328 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,6 +47,13 @@
test
+
+ org.mariadb.jdbc
+ mariadb-java-client
+ 2.6.0
+
+
+
org.seleniumhq.selenium
selenium-java
@@ -88,4 +95,4 @@
test
-
\ No newline at end of file
+
diff --git a/src/main/java/L13/App.java b/src/main/java/L13/App.java
index 538cbb6..9ec277e 100644
--- a/src/main/java/L13/App.java
+++ b/src/main/java/L13/App.java
@@ -19,6 +19,21 @@ public static void main(String[] args) {
chau.bark();
colly.bark();
+// 1. abstract class - нельзя создать объекты абстрактного класса
+// 2. abstract method - нет тела метода -> нельзя создать создать объекты -> это абстрактный класс
+// 3. final class - его нельзя расширять (нельзя от него наследовать) - нет детей
+// 4. interface - содержат только методы без тел (абстрактные методы)
+// 4а. Все классы, которые имплементируют интерфейс должны определить ВСЕ его методы.
+// 4б. Полиморфизм - объекты интерфейсов могут содержать объекты детских классов.
+// Collapse
+
+
+
+
+
+
+
+
}
}
diff --git a/src/main/java/L15/App.java b/src/main/java/L15/App.java
new file mode 100644
index 0000000..afe8547
--- /dev/null
+++ b/src/main/java/L15/App.java
@@ -0,0 +1,55 @@
+package L15;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class App {
+ public static void main(String[] args) {
+ List names = new ArrayList();
+ String[] namesOld = new String[5];
+
+ names.add("Shaun");
+ names.add("James");
+ names.add("John");
+ names.add("Poul");
+ names.add("Shaun");
+ System.out.println(names);
+ List colors = new ArrayList(Arrays.asList("Red", "Green"));
+
+// namesOld[0] = "James";
+// namesOld[1] = "John";
+ names.add(0,"David");
+ System.out.println(names);
+// System.out.println(names.get(0));
+ names.set(3,"Andrew");
+ System.out.println(names);
+// System.out.println(names.get(3));
+ names.remove(2);
+ System.out.println(names);
+// System.out.println(namesOld[0]);
+// System.out.println(names.get(2));
+ System.out.println(names.size());
+ names.remove("Shaun");
+ System.out.println(names);
+ System.out.println(names.contains("Shaun"));
+ System.out.println(names.contains("Freddy"));
+ List temp = new ArrayList<>();
+ System.out.println(names.size());
+
+ for (String v:names) {
+ System.out.println(v);
+ }
+
+ names.forEach(x-> System.out.println(x));
+
+ names.forEach(System.out::println);
+
+ List people = new ArrayList<>();
+
+// ArrayList xx = null;
+// xx.add(23.6);
+
+
+ }
+}
diff --git a/src/main/java/L15/Person.java b/src/main/java/L15/Person.java
new file mode 100644
index 0000000..61c7d5c
--- /dev/null
+++ b/src/main/java/L15/Person.java
@@ -0,0 +1,11 @@
+package L15;
+
+import java.util.List;
+
+public class Person {
+ public List names;
+
+ public Person(List names) {
+ this.names = names;
+ }
+}
diff --git a/src/main/java/L16/App.java b/src/main/java/L16/App.java
new file mode 100644
index 0000000..fde0b6a
--- /dev/null
+++ b/src/main/java/L16/App.java
@@ -0,0 +1,53 @@
+package L16;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class App {
+ public static void main(String[] args) {
+ Map countries = new HashMap();
+ countries.put("USA","Washington");
+ countries.put("Germany","Berlin");
+ countries.put("Bulgaria","Sofia");
+
+ System.out.println(countries);
+ System.out.println(countries.size());
+ countries.replace("Germany","Bonn");
+ System.out.println(countries);
+ countries.put("Bulgaria","Tirana");
+ countries.put("Albania","Tirana");
+ System.out.println(countries);
+ System.out.println(countries.get("Germany"));
+ System.out.println(countries.get("GermanY"));
+ countries.remove("Bulgaria");
+ System.out.println(countries);
+
+ for (Map.Entry kv:countries.entrySet()){
+ System.out.println(kv.getKey());
+ System.out.println(kv.getValue());
+ }
+
+ for (String key: countries.keySet()){
+ System.out.println(key);
+ }
+
+ for (String value:countries.values()){
+ System.out.println(value);
+ }
+
+// Map colors= new HashMap<>();
+// colors.put(0,"Red");
+// colors.put(1,"Black");
+// colors.put(2,"Green");
+// colors.get(1);
+ Map colors = new HashMap<>();
+ colors.put("red","apple");
+ colors.put("black","coal");
+ colors.put("white","snow");
+ colors.put("green","apple");
+
+ Map employ = new HashMap<>();
+ employ.put(new Person(),new Job());
+
+ }
+}
diff --git a/src/main/java/L16/Job.java b/src/main/java/L16/Job.java
new file mode 100644
index 0000000..8f3312c
--- /dev/null
+++ b/src/main/java/L16/Job.java
@@ -0,0 +1,4 @@
+package L16;
+
+public class Job {
+}
diff --git a/src/main/java/L16/Person.java b/src/main/java/L16/Person.java
new file mode 100644
index 0000000..7bd0921
--- /dev/null
+++ b/src/main/java/L16/Person.java
@@ -0,0 +1,4 @@
+package L16;
+
+public class Person {
+}
diff --git a/src/main/java/L17/App.java b/src/main/java/L17/App.java
new file mode 100644
index 0000000..ba61b14
--- /dev/null
+++ b/src/main/java/L17/App.java
@@ -0,0 +1,31 @@
+package L17;
+
+public class App {
+ public static void main(String[] args) {
+ int[] xx = {2,5,1};
+
+ try {
+ int vv = xx[1];
+ int vvv = 6/0;
+ System.out.println("I'm not wrong");
+ } catch (ArrayIndexOutOfBoundsException err){
+ System.out.println("I'm WRONG");
+ } catch (ArithmeticException err){
+ System.out.println("Divide by ZERO");
+ } catch (Exception err) {
+ System.out.println("Unknown exception");
+// throw new Exception("Errrrrr");
+ }
+ finally {
+ System.out.println("I will run in any case");
+ }
+
+ var p = new Person("Ivan", "Krotov");
+ var p2 = new Person("Doris","Sun");
+ Person.counter=10;
+ Person.setCounter(15);
+ System.out.println(Person.getCounter());
+
+ }
+
+}
diff --git a/src/main/java/L17/Person.java b/src/main/java/L17/Person.java
new file mode 100644
index 0000000..0355ac0
--- /dev/null
+++ b/src/main/java/L17/Person.java
@@ -0,0 +1,20 @@
+package L17;
+
+public class Person {
+ private String name;
+ private String lastName;
+ public static int counter;
+
+ public Person(String name, String lastName) {
+ this.name = name;
+ this.lastName = lastName;
+ }
+
+ public static int getCounter() {
+ return counter;
+ }
+
+ public static void setCounter(int counter) {
+ Person.counter = counter;
+ }
+}
diff --git a/src/main/java/MyFile.java b/src/main/java/MyFile.java
index 12d2458..3899d60 100644
--- a/src/main/java/MyFile.java
+++ b/src/main/java/MyFile.java
@@ -1,2 +1,43 @@
public class MyFile {
+ public static void main(String[] args) {
+ System.out.println("Hello, Github");
+ int res= mult3(3,3,5);
+ System.out.println(res);
+ int price =260;
+
+ int age1=32;
+ int age2=30;
+ int age3=68;
+ int age4=5;
+ double age5=1.8;
+ System.out.println("pers1="+ticketPrice(age1,price));
+ System.out.println("pers2="+ticketPrice(age2,price));
+ System.out.println("pers3="+ticketPrice(age3,price));
+ System.out.println("pers4="+ticketPrice(age4,price));
+ System.out.println("pers5="+ticketPrice(age5,price));
+
+ }
+ public static int mult3 ( int a, int b, int c){
+ int x = a * b * c;
+ return x;
+ }
+ public static double ticketPrice (double age, double price) {
+ double ticketPrice = price;
+ if (age < 2) {
+ ticketPrice = 0;
+ }
+ if (age >= 2 && age <= 12) {
+ ticketPrice = price * 0.5;
+ }
+ if (age > 12 && age < 66) {
+ ticketPrice = price;
+ }
+ if (age >= 66) {
+ ticketPrice = price * 0.8;
+ }
+ return ticketPrice;
+
+
+
+ }
}
diff --git a/src/main/java/hw10/Bicycle.java b/src/main/java/hw10/Bicycle.java
new file mode 100644
index 0000000..cfc9026
--- /dev/null
+++ b/src/main/java/hw10/Bicycle.java
@@ -0,0 +1,60 @@
+package hw10;
+
+public class Bicycle {
+ private String brand;
+ private String color;
+ private double price;
+ private int[] size;
+
+
+ public Bicycle(String brand1, String color1, double price1,int[]size1) {
+ brand = brand1;
+ color = color1;
+ price = price1;
+ size=size1;
+ }
+
+ public Bicycle() {
+ }
+
+
+ public void ride() {
+ System.out.println("I am riding " + brand + ".");
+ }
+
+ public String getBrand() {
+ return brand;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public int[] getSize() {
+ return size;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public void setPrice(double price) {
+ if (price<150){
+ System.out.println("Very good price!");
+ this.price=1;
+ }
+ this.price = price;
+ }
+
+ public void setSize(int[] size) {
+ this.size = size;
+ }
+}
diff --git a/src/main/java/hw10/Doctor.java b/src/main/java/hw10/Doctor.java
new file mode 100644
index 0000000..9b622a6
--- /dev/null
+++ b/src/main/java/hw10/Doctor.java
@@ -0,0 +1,58 @@
+package hw10;
+
+public class Doctor {
+ private String name;
+ private String type;
+ private int age;
+ private int[] floor;
+
+ public Doctor(String n, String t, int a,int[]f) {
+ name = n;
+ type = t;
+ age = a;
+ floor=f;
+
+ }
+
+ public Doctor() {
+ }
+
+ public Doctor(String alex, String cardiolog, int a, int i) {
+ }
+
+ public void printDoctorInfo() {
+ System.out.println(name+" "+" " +" is " +type+" "+" and " +age+" years old" + " He is on the "+ floor.length);
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public void setFloor(int[] floor) {
+ this.floor = floor;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public int[] getFloor() {
+ return floor;
+ }
+}
diff --git a/src/main/java/hw10/Tree.java b/src/main/java/hw10/Tree.java
new file mode 100644
index 0000000..4e3b27d
--- /dev/null
+++ b/src/main/java/hw10/Tree.java
@@ -0,0 +1,61 @@
+package hw10;
+
+public class Tree {
+ private String name;
+ private double height;
+ private int years;
+
+ public Tree(String name, double height, int years) {
+ this.name = name;
+ this.height = height;
+ this.years = years;
+
+ }
+
+ public Tree(double height) {
+ this.height = height;
+ }
+
+ public Tree(String name, int years) {
+ this.years = years;
+ this.name = name;
+ }
+
+ public void printHeight() {
+ if (height == 0) {
+ System.out.println("It wasn't planted");
+ return;
+ }
+ System.out.println(height);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public double getHeight() {
+ return height;
+ }
+
+ public void setHeight(double height) {
+ if (height > 80.0 && height < 80.5) {
+ this.height = height;
+ return;
+ }
+ System.out.println("This size is normal");
+ this.height = 80.8;
+ }
+
+ public int getYears() {
+ return years;
+ }
+
+ public void setYears(int years) {
+ this.years = years;
+ }
+}
+
diff --git a/src/main/java/hw10/Work10.java b/src/main/java/hw10/Work10.java
new file mode 100644
index 0000000..d7a0a6b
--- /dev/null
+++ b/src/main/java/hw10/Work10.java
@@ -0,0 +1,37 @@
+package hw10;
+
+public class Work10 {
+ public static void main(String[] args) {
+ Bicycle huffy = new Bicycle();
+ huffy.setBrand("Huffy");
+ huffy.setColor("red");
+ huffy.setPrice(119.99);
+ int[]z={10,20,30};
+ Bicycle aero = new Bicycle();
+ aero.setBrand("Aero");
+ aero.setColor("black");
+ aero.setPrice(239.19);
+ aero.setSize(z);
+
+ System.out.println(aero.getBrand());
+ System.out.println(huffy.getPrice());
+
+ huffy.ride();
+ aero.ride();
+ int[] f1={2,3,5};
+ Doctor alex =new Doctor("Alex","cardiolog",35,f1);
+ int[]f2={2,8,5,4};
+ Doctor oleg = new Doctor("Oleg","surgeon",40,f2);
+ alex.printDoctorInfo();
+ oleg.printDoctorInfo();
+ alex.setFloor(f1);
+
+ var tree=new Tree("Maple",0.0,200);
+ tree.printHeight();
+
+ Tree tree1=new Tree ("Palm",80.5,25);
+ tree1.printHeight();
+ tree1.setHeight(80.5);
+ }
+}
+
diff --git a/src/main/java/hw11/Airport.java b/src/main/java/hw11/Airport.java
new file mode 100644
index 0000000..ee2cc13
--- /dev/null
+++ b/src/main/java/hw11/Airport.java
@@ -0,0 +1,18 @@
+package hw11;
+
+public class Airport {
+ private Plane plane;
+ private Gate gate;
+
+ public Airport(Plane plane, Gate gate) {
+ this.plane = plane;
+ this.gate = gate;
+ }
+ public Airport(){
+
+ }
+ public void printInfo() {
+ String a=("In Manas Airport = " + plane + " + " + gate);
+ System.out.println(a);
+ }
+}
diff --git a/src/main/java/hw11/Computer.java b/src/main/java/hw11/Computer.java
new file mode 100644
index 0000000..4a155cf
--- /dev/null
+++ b/src/main/java/hw11/Computer.java
@@ -0,0 +1,40 @@
+package hw11;
+
+public class Computer {
+ private Monitor monitor;
+ private SysBlock sysBlock;
+ private Mouse mouse;
+ private Keyboard keyboard;
+
+ public Computer(Monitor monitor, SysBlock sysBlock, Mouse mouse, Keyboard keyboard) {
+ this.monitor = monitor;
+ this.sysBlock = sysBlock;
+ this.mouse = mouse;
+ this.keyboard = keyboard;
+ }
+
+ public Monitor getMonitor() {
+ return monitor;
+ }
+
+ public SysBlock getSysBlock() {
+ return sysBlock;
+ }
+
+ public Mouse getMouse() {
+ return mouse;
+ }
+
+ public Keyboard getKeyboard() {
+ return keyboard;
+ }
+
+ public void printInfo(){
+ monitor.printInfo();
+ keyboard.printInfo();
+ mouse.printInfo();
+ sysBlock.printInfo();
+
+ }
+
+}
diff --git a/src/main/java/hw11/Gate.java b/src/main/java/hw11/Gate.java
new file mode 100644
index 0000000..b6fa6c6
--- /dev/null
+++ b/src/main/java/hw11/Gate.java
@@ -0,0 +1,46 @@
+package hw11;
+
+public class Gate {
+ private String name;
+ private int number;
+
+ public Gate(String name, int number) {
+ this.name = name;
+ this.number = number;
+ }public Gate(){
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getNumber() {
+ return number;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setNumber(int number) {
+ this.number = number;
+ }
+
+ @Override
+ public String toString() {
+ return "Gate " +
+ name + +
+ + number
+ ;
+ }
+}
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/hw11/Keyboard.java b/src/main/java/hw11/Keyboard.java
new file mode 100644
index 0000000..cbc0485
--- /dev/null
+++ b/src/main/java/hw11/Keyboard.java
@@ -0,0 +1,12 @@
+package hw11;
+
+public class Keyboard {
+ private String brand;
+
+ public Keyboard(String brand) {
+ this.brand = brand;
+ }
+ public void printInfo(){
+ System.out.println("Keyboard brand = " + brand);
+ }
+}
diff --git a/src/main/java/hw11/Monitor.java b/src/main/java/hw11/Monitor.java
new file mode 100644
index 0000000..41e292b
--- /dev/null
+++ b/src/main/java/hw11/Monitor.java
@@ -0,0 +1,20 @@
+package hw11;
+
+public class Monitor {
+ private String brand;
+ private String model;
+ private int diag;
+
+ public Monitor(String brand, String model, int diag) {
+ this.brand = brand;
+ this.model = model;
+ this.diag = diag;
+ }
+
+
+
+ public void printInfo() {
+ String xx= "Monitor{brand=" + brand + ", model=" + model + ", diag=" + diag +'}';
+ System.out.println(xx);
+ }
+}
diff --git a/src/main/java/hw11/Motherboard.java b/src/main/java/hw11/Motherboard.java
new file mode 100644
index 0000000..0477a27
--- /dev/null
+++ b/src/main/java/hw11/Motherboard.java
@@ -0,0 +1,52 @@
+package hw11;
+
+public class Motherboard {
+ private String type;
+ private int ram;
+ private long serial;
+
+ public Motherboard(String type, int ram, long serial) {
+ this.type = type;
+ this.ram = ram;
+ this.serial = serial;
+ }
+ public Motherboard(){
+
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public int getRam() {
+ return ram;
+ }
+
+ public long getSerial() {
+ return serial;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void setRam(int ram) {
+ this.ram = ram;
+ }
+
+ public void setSerial(long serial) {
+ this.serial = serial;
+ }
+
+ @Override
+ public String toString() {
+ return "Motherboard{" +
+ "type='" + type + '\'' +
+ ", ram=" + ram +
+ ", serial=" + serial +
+ '}';
+ }
+// public void printInfo() {
+// System.out.println("MotherBoard = " + type + "RAM - " + ram + "serial NO SSN " + serial);
+ }
+
diff --git a/src/main/java/hw11/Mouse.java b/src/main/java/hw11/Mouse.java
new file mode 100644
index 0000000..11bff8e
--- /dev/null
+++ b/src/main/java/hw11/Mouse.java
@@ -0,0 +1,12 @@
+package hw11;
+
+public class Mouse {
+ private String brand;
+
+ public Mouse(String brand) {
+ this.brand = brand;
+ }
+ public void printInfo(){
+ System.out.println("Mouse = "+ brand);
+ }
+}
diff --git a/src/main/java/hw11/Plane.java b/src/main/java/hw11/Plane.java
new file mode 100644
index 0000000..c491b8b
--- /dev/null
+++ b/src/main/java/hw11/Plane.java
@@ -0,0 +1,51 @@
+package hw11;
+
+public class Plane {
+ private String name;
+ private int seat;
+ private String country;
+
+ public Plane(String name, int seat, String country) {
+ this.name = name;
+ this.seat = seat;
+ this.country = country;
+ }
+ public Plane(){
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getSeat() {
+ return seat;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setSeat(int seat) {
+ this.seat = seat;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ @Override
+ public String toString() {
+ return "Plane " +
+ name + '\'' +
+ ", seat=" + seat +
+ ", from'" + country + '\''
+ ;
+ }
+}
+
+
diff --git a/src/main/java/hw11/Processor.java b/src/main/java/hw11/Processor.java
new file mode 100644
index 0000000..e2ecdaa
--- /dev/null
+++ b/src/main/java/hw11/Processor.java
@@ -0,0 +1,42 @@
+package hw11;
+
+public class Processor {
+ private String type;
+ private double speed;
+ private String storage;
+
+ public Processor(String type, double speed, String storage) {
+ this.type = type;
+ this.speed = speed;
+ this.storage = storage;
+
+ }
+ public Processor(){
+
+
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public double getSpeed() {
+ return speed;
+ }
+
+ public String getStorage() {
+ return storage;
+ }
+
+ @Override
+ public String toString() {
+ return "Processor{" +
+ "type='" + type + '\'' +
+ ", speed=" + speed +
+ ", storage='" + storage + '\'' +
+ '}';
+ }
+ // public void printInfo() {
+// String xx = "Processor{"Processor = " + type+ "speed - " + speed + "storage - "+storage '}'
+// }
+}
diff --git a/src/main/java/hw11/SysBlock.java b/src/main/java/hw11/SysBlock.java
new file mode 100644
index 0000000..01fcd5a
--- /dev/null
+++ b/src/main/java/hw11/SysBlock.java
@@ -0,0 +1,27 @@
+package hw11;
+
+public class SysBlock {
+ private Processor processor;
+ private Motherboard motherboard;
+
+ public SysBlock(Processor processor, Motherboard motherboard) {
+ this.processor = processor;
+ this.motherboard = motherboard;
+
+ }
+
+ public Processor getProcessor() {
+ return processor;
+ }
+
+ public Motherboard getMotherboard() {
+ return motherboard;
+ }
+
+ public SysBlock() {
+
+ }
+ public void printInfo() {
+ System.out.println("SysBlock = " + processor + " + " + motherboard);
+ }
+}
diff --git a/src/main/java/hw11/Work11.java b/src/main/java/hw11/Work11.java
new file mode 100644
index 0000000..8f8e7f0
--- /dev/null
+++ b/src/main/java/hw11/Work11.java
@@ -0,0 +1,37 @@
+package hw11;
+
+public class Work11 {
+ public static void main(String[] args) {
+ Mouse mouse = new Mouse("Logitech");
+ mouse.printInfo();
+
+ Keyboard kb = new Keyboard("Microsoft");
+ kb.printInfo();
+
+ Monitor monitor = new Monitor("Samsung", "XX-20", 32);
+ monitor.printInfo();
+
+ SysBlock sys = new SysBlock(new Processor("Core",4.0,"VNX"), new Motherboard("Asus",128,01));
+ Motherboard moth = new Motherboard("Asus", 128, 01);
+ Processor pro = new Processor("Core", 4.0, " VNX");
+
+
+ var sysb=sys.getProcessor().getStorage();
+ System.out.println(sysb);
+
+ var pros=sys.getMotherboard().getType();
+ System.out.println(pros);
+
+
+
+
+
+ Computer dell = new Computer(monitor, sys, mouse, kb);
+ dell.printInfo();
+
+
+
+
+ }
+}
+
diff --git a/src/main/java/hw11/Worksecond.java b/src/main/java/hw11/Worksecond.java
new file mode 100644
index 0000000..2269921
--- /dev/null
+++ b/src/main/java/hw11/Worksecond.java
@@ -0,0 +1,11 @@
+package hw11;
+
+public class Worksecond {
+ public static void main(String[] args) {
+ Airport manas =new Airport(new Plane("Boing",320,"Turkey"),new Gate ("A",36));
+ Plane plane =new Plane("Boing",320,"Turkey");
+ Gate gate =new Gate("A",36);
+
+ manas.printInfo();
+ }
+}
diff --git a/src/main/java/hw12/Herbs.java b/src/main/java/hw12/Herbs.java
new file mode 100644
index 0000000..d9f4939
--- /dev/null
+++ b/src/main/java/hw12/Herbs.java
@@ -0,0 +1,10 @@
+package hw12;
+
+public class Herbs extends Plants{
+ private String color;
+
+ public Herbs(String name, String type, String color) {
+ super(name, type);
+ this.color = color;
+ }
+}
diff --git a/src/main/java/hw12/Plants.java b/src/main/java/hw12/Plants.java
new file mode 100644
index 0000000..4a42a0c
--- /dev/null
+++ b/src/main/java/hw12/Plants.java
@@ -0,0 +1,14 @@
+package hw12;
+
+public class Plants {
+ private String name;
+ private String type;
+
+ public Plants(String name, String type) {
+ this.name = name;
+ this.type = type;
+ }
+ public void like(){
+ System.out.println("I like "+ name);
+ }
+}
diff --git a/src/main/java/hw12/Tree.java b/src/main/java/hw12/Tree.java
new file mode 100644
index 0000000..75223db
--- /dev/null
+++ b/src/main/java/hw12/Tree.java
@@ -0,0 +1,10 @@
+package hw12;
+
+public class Tree extends Plants {
+ private int height;
+
+ public Tree(String name, String type, int height) {
+ super(name, type);
+ this.height = height;
+ }
+}
diff --git a/src/main/java/hw12/Work12.java b/src/main/java/hw12/Work12.java
new file mode 100644
index 0000000..c32d703
--- /dev/null
+++ b/src/main/java/hw12/Work12.java
@@ -0,0 +1,11 @@
+package hw12;
+
+public class Work12 {
+ public static void main(String[] args) {
+ Tree cedar=new Tree("Cedar","Wood",120);
+ cedar.like();
+ Herbs basil=new Herbs("Basil","sweet","green");
+ basil.like();
+ }
+
+}
diff --git a/src/main/java/hw13/College.java b/src/main/java/hw13/College.java
new file mode 100644
index 0000000..d498596
--- /dev/null
+++ b/src/main/java/hw13/College.java
@@ -0,0 +1,18 @@
+package hw13;
+
+public class College implements Education {
+ private int age;
+
+ public College(int age) {
+ this.age = age;
+ }
+ public void study() {
+ System.out.println("My son is studying in Houston College");
+ }
+ public void teach() {
+ System.out.println("In Houston College there are great professors teach ");
+ }
+ public int getAge() {
+ return age;
+ }
+}
diff --git a/src/main/java/hw13/Education.java b/src/main/java/hw13/Education.java
new file mode 100644
index 0000000..7a1e29c
--- /dev/null
+++ b/src/main/java/hw13/Education.java
@@ -0,0 +1,7 @@
+package hw13;
+
+public interface Education {
+ public void study();
+ public void teach();
+ public int getAge();
+}
diff --git a/src/main/java/hw13/School.java b/src/main/java/hw13/School.java
new file mode 100644
index 0000000..5a8abd3
--- /dev/null
+++ b/src/main/java/hw13/School.java
@@ -0,0 +1,19 @@
+package hw13;
+
+public class School implements Education {
+ private int age;
+
+ public School(int age) {
+ this.age = age;
+ }
+ public void study() {
+ System.out.println("Her children study in elementary school. ");
+ }
+ public void teach() {
+ System.out.println("She is teaching in this school.");
+ }
+ public int getAge() {
+ return age;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/hw13/Work13.java b/src/main/java/hw13/Work13.java
new file mode 100644
index 0000000..84fcdd2
--- /dev/null
+++ b/src/main/java/hw13/Work13.java
@@ -0,0 +1,25 @@
+package hw13;
+
+public class Work13 {
+ public static void main(String[] args) {
+ Education son = new College(19);
+ son.study();
+ son.teach();
+
+ var herSon = new School(8);
+ herSon.study();
+ herSon.teach();
+
+ }
+
+}
+// Создайте интерфейс и 2 класса которые его имплементируют
+//// Создайте по 2 объекта каждого класса типа Интерфейса
+
+
+
+
+
+
+
+
diff --git a/src/main/java/hw14/Amphibians.java b/src/main/java/hw14/Amphibians.java
new file mode 100644
index 0000000..736e5ee
--- /dev/null
+++ b/src/main/java/hw14/Amphibians.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Amphibians extends Vertebrates {
+ public void ectothermic();
+}
diff --git a/src/main/java/hw14/Animals.java b/src/main/java/hw14/Animals.java
new file mode 100644
index 0000000..bc51164
--- /dev/null
+++ b/src/main/java/hw14/Animals.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Animals extends Life {
+ public void name();
+}
diff --git a/src/main/java/hw14/Bacteria.java b/src/main/java/hw14/Bacteria.java
new file mode 100644
index 0000000..1296682
--- /dev/null
+++ b/src/main/java/hw14/Bacteria.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Bacteria extends Life{
+ public void motile();
+}
diff --git a/src/main/java/hw14/Birds.java b/src/main/java/hw14/Birds.java
new file mode 100644
index 0000000..adfaf86
--- /dev/null
+++ b/src/main/java/hw14/Birds.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Birds extends Vertebrates {
+ public void canFly();
+}
diff --git a/src/main/java/hw14/BlueWhale.java b/src/main/java/hw14/BlueWhale.java
new file mode 100644
index 0000000..5a678a7
--- /dev/null
+++ b/src/main/java/hw14/BlueWhale.java
@@ -0,0 +1,70 @@
+package hw14;
+
+public class BlueWhale extends Carnivores {
+private int mass;
+
+ public int getMass() {
+ return mass;
+ }
+
+ public void setMass(int mass) {
+ this.mass = mass;
+ }
+
+ public BlueWhale(int mass) {
+ this.mass = mass;
+
+ }
+
+
+ @Override
+ public void produceMilk() {
+
+ }
+
+ @Override
+ public void haveBackbone() {
+
+ }
+
+ @Override
+ public void name() {
+ System.out.println("3) Blue Whale's name is Balaenoptera musculus.");
+ }
+
+ @Override
+ public void canBreathe() {
+ System.out.println(" Blue whales breathe by swimming to the surface of the water.");
+
+ }
+
+ @Override
+ public void canEat() {
+ System.out.println(" Blue whales eat krill (euphausiids) and copepods.");
+
+
+ }
+
+ @Override
+ public void canDo() {
+ System.out.println(" Blue whales feed during the day and rest at night.");
+
+ }
+
+ @Override
+ public void canLove() {
+ System.out.println(" Blue whales of the world are capable of loving.");
+
+ }
+
+ @Override
+ public void canEnjoy() {
+ System.out.println(" Blue Whale is the largest animal ever to have lived on earth.");
+
+ }
+
+ @Override
+ public String toString() {
+ return " Blue Whale mass = "+ mass+" lbs.";
+ }
+}
diff --git a/src/main/java/hw14/Carnivores.java b/src/main/java/hw14/Carnivores.java
new file mode 100644
index 0000000..b86f6d8
--- /dev/null
+++ b/src/main/java/hw14/Carnivores.java
@@ -0,0 +1,6 @@
+package hw14;
+
+public abstract class Carnivores implements Mammals {
+ private int age;
+
+}
diff --git a/src/main/java/hw14/FinalProject.java b/src/main/java/hw14/FinalProject.java
new file mode 100644
index 0000000..8731c0f
--- /dev/null
+++ b/src/main/java/hw14/FinalProject.java
@@ -0,0 +1,40 @@
+package hw14;
+
+public class FinalProject {
+ public static void main(String[] args) {
+
+ Lion lion = new Lion(50);
+ lion.name();
+ lion.canBreathe();
+ lion.haveBackbone();
+ lion.canEat();
+ lion.produceMilk();
+ lion.canDo();
+ lion.canLove();
+ lion.canEnjoy();
+ System.out.println(" Lion's speed "+ new Lion(50));
+
+ Wolf wolf = new Wolf(6);
+ wolf.name();
+ wolf.canBreathe();
+ wolf.haveBackbone();
+ wolf.canDo();
+ wolf.canEat();
+ wolf.produceMilk();
+ wolf.canEnjoy();
+ wolf.canLove();
+ System.out.println(new Wolf(6));
+
+ BlueWhale whale = new BlueWhale(110000);
+ whale.name();
+ whale.canBreathe();
+ whale.canEat();
+ whale.haveBackbone();
+ whale.produceMilk();
+ whale.canDo();
+ whale.canEnjoy();
+ whale.canLove();
+ System.out.println(new BlueWhale(110000));
+
+ }
+}
diff --git a/src/main/java/hw14/Fish.java b/src/main/java/hw14/Fish.java
new file mode 100644
index 0000000..3ab82b0
--- /dev/null
+++ b/src/main/java/hw14/Fish.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Fish extends Vertebrates {
+ public void liveWater();
+}
diff --git a/src/main/java/hw14/Fungi.java b/src/main/java/hw14/Fungi.java
new file mode 100644
index 0000000..2c56aca
--- /dev/null
+++ b/src/main/java/hw14/Fungi.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Fungi extends Life {
+ public void nutrientcCycling();
+}
diff --git a/src/main/java/hw14/Herbivores.java b/src/main/java/hw14/Herbivores.java
new file mode 100644
index 0000000..f0817a7
--- /dev/null
+++ b/src/main/java/hw14/Herbivores.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public abstract class Herbivores implements Mammals {
+ private String getEnergy;
+}
diff --git a/src/main/java/hw14/Invertebrates.java b/src/main/java/hw14/Invertebrates.java
new file mode 100644
index 0000000..98ded53
--- /dev/null
+++ b/src/main/java/hw14/Invertebrates.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Invertebrates extends Animals{
+ public void nonVertebral();
+}
diff --git a/src/main/java/hw14/Life.java b/src/main/java/hw14/Life.java
new file mode 100644
index 0000000..bd65ad8
--- /dev/null
+++ b/src/main/java/hw14/Life.java
@@ -0,0 +1,9 @@
+package hw14;
+
+public interface Life {
+ public void canBreathe();
+ public void canEat();
+ public void canDo();
+ public void canLove();
+ public void canEnjoy();
+}
diff --git a/src/main/java/hw14/Lion.java b/src/main/java/hw14/Lion.java
new file mode 100644
index 0000000..a493981
--- /dev/null
+++ b/src/main/java/hw14/Lion.java
@@ -0,0 +1,72 @@
+package hw14;
+
+public class Lion extends Carnivores {
+ public int speed;
+
+
+ @Override
+ public String toString() {
+ return "=" + speed ;
+ }
+
+ public int getSpeed() {
+ return speed;
+ }
+
+ public void setSpeed(int speed) {
+ this.speed = speed;
+ }
+
+ public Lion(int speed) {
+ this.speed = speed;
+
+ }
+
+ @Override
+ public void produceMilk() {
+ System.out.println(" Young cubs drink milk from their mother's teats.");
+
+ }
+
+ @Override
+ public void haveBackbone() {
+ System.out.println(" Lion's backbone is a gliding joint, allowing the animal to be flexible");
+
+ }
+
+ @Override
+ public void name() {
+ System.out.println("1) Lion's name is Panthera leo.");
+
+ }
+
+ @Override
+ public void canBreathe() {
+ System.out.println(" Lion can breathe.");
+
+ }
+
+ @Override
+ public void canEat() {
+ System.out.println(" Lion eat antelopes, buffaloes, zebras, young elephants, rhinos, hippos, wild hogs, crocodiles and giraffes.");
+
+ }
+
+ @Override
+ public void canDo() {
+ System.out.println(" Lions usually hunt at night.");
+
+ }
+
+ @Override
+ public void canLove() {
+ System.out.println(" Lion can have relationships with humans, and love them. ");
+
+ }
+
+ @Override
+ public void canEnjoy() {
+ System.out.println(" Lion can enjoy.");
+
+ }
+}
diff --git a/src/main/java/hw14/Mammals.java b/src/main/java/hw14/Mammals.java
new file mode 100644
index 0000000..a8b1d83
--- /dev/null
+++ b/src/main/java/hw14/Mammals.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Mammals extends Vertebrates {
+ public void produceMilk();
+}
diff --git a/src/main/java/hw14/Plants.java b/src/main/java/hw14/Plants.java
new file mode 100644
index 0000000..c24d8e1
--- /dev/null
+++ b/src/main/java/hw14/Plants.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Plants extends Life {
+ public void important();
+}
diff --git a/src/main/java/hw14/Primates.java b/src/main/java/hw14/Primates.java
new file mode 100644
index 0000000..88a78b2
--- /dev/null
+++ b/src/main/java/hw14/Primates.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public abstract class Primates implements Mammals {
+ private String kingdom;
+}
diff --git a/src/main/java/hw14/Reptilies.java b/src/main/java/hw14/Reptilies.java
new file mode 100644
index 0000000..fdf577f
--- /dev/null
+++ b/src/main/java/hw14/Reptilies.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Reptilies extends Vertebrates {
+ public void tetrapod();
+}
diff --git a/src/main/java/hw14/Rodents.java b/src/main/java/hw14/Rodents.java
new file mode 100644
index 0000000..5c875de
--- /dev/null
+++ b/src/main/java/hw14/Rodents.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public abstract class Rodents implements Mammals {
+ private int LifeSpan;
+}
diff --git a/src/main/java/hw14/Seals.java b/src/main/java/hw14/Seals.java
new file mode 100644
index 0000000..906b041
--- /dev/null
+++ b/src/main/java/hw14/Seals.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public abstract class Seals implements Mammals {
+ private double lenght;
+}
diff --git a/src/main/java/hw14/Vertebrates.java b/src/main/java/hw14/Vertebrates.java
new file mode 100644
index 0000000..ce6dd71
--- /dev/null
+++ b/src/main/java/hw14/Vertebrates.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public interface Vertebrates extends Animals {
+ public void haveBackbone();
+}
diff --git a/src/main/java/hw14/Whales.java b/src/main/java/hw14/Whales.java
new file mode 100644
index 0000000..4d6daa2
--- /dev/null
+++ b/src/main/java/hw14/Whales.java
@@ -0,0 +1,5 @@
+package hw14;
+
+public abstract class Whales implements Mammals {
+ private int gestationPeriod;
+}
diff --git a/src/main/java/hw14/Wolf.java b/src/main/java/hw14/Wolf.java
new file mode 100644
index 0000000..4c49013
--- /dev/null
+++ b/src/main/java/hw14/Wolf.java
@@ -0,0 +1,69 @@
+package hw14;
+
+public class Wolf extends Carnivores {
+ private int lifeSpan;
+
+ public Wolf(int lifeSpan) {
+ this.lifeSpan = lifeSpan;
+ }
+
+ @Override
+ public String toString() {
+ return " Wolf's life Span "+lifeSpan+"-8 years";
+ }
+
+ public int getLifeSpan() {
+ return lifeSpan;
+ }
+
+ public void setLifeSpan(int lifeSpan) {
+ this.lifeSpan = lifeSpan;
+ }
+
+ @Override
+ public void produceMilk() {
+ System.out.println(" Female wolves produce milk to feed their cubs");
+
+ }
+
+ @Override
+ public void haveBackbone() {
+ System.out.println(" Wolf's backbone that serves as a frame for the rest of the body.");
+
+ }
+
+ @Override
+ public void name() {
+ System.out.println("2) Wolf's name is Least Concern");
+ }
+
+ @Override
+ public void canBreathe() {
+ System.out.println(" Wolf do not hold their breath");
+
+ }
+
+ @Override
+ public void canEat() {
+ System.out.println(" Wolves are carnivores, which mean they eat meat as their main food source. ");
+
+ }
+
+ @Override
+ public void canDo() {
+ System.out.println(" Wolves live and hunt in packs of around six to ten animals");
+
+ }
+
+ @Override
+ public void canLove() {
+ System.out.println(" A wolf-lover is a person who loves wolves so much they cannot love them more!");
+
+ }
+
+ @Override
+ public void canEnjoy() {
+ System.out.println(" A single wolf is capable of catching and killing a deer unaided");
+
+ }
+}
diff --git a/src/main/java/hw15/Book.java b/src/main/java/hw15/Book.java
new file mode 100644
index 0000000..4d9cf2c
--- /dev/null
+++ b/src/main/java/hw15/Book.java
@@ -0,0 +1,26 @@
+package hw15;
+
+public class Book {
+ int id;
+ String name, author, publisher;
+ int quantity;
+
+ public Book(int id, String name, String author, String publisher, int quantity) {
+ this.id = id;
+ this.name = name;
+ this.author = author;
+ this.publisher = publisher;
+ this.quantity = quantity;
+ }
+
+ @Override
+ public String toString() {
+ return "Book{" +
+ "id=" + id +
+ ", name='" + name + '\'' +
+ ", author='" + author + '\'' +
+ ", publisher='" + publisher + '\'' +
+ ", quantity=" + quantity +
+ '}';
+ }
+}
diff --git a/src/main/java/hw15/Food.java b/src/main/java/hw15/Food.java
new file mode 100644
index 0000000..e9b4643
--- /dev/null
+++ b/src/main/java/hw15/Food.java
@@ -0,0 +1,34 @@
+package hw15;
+
+public class Food {
+ private String name;
+ private int weight;
+
+ public Food(String name, int weight) {
+ this.name = name;
+ this.weight = weight;
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public void setWeight(int weight) {
+ this.weight = weight;
+ }
+
+ public String toString() {
+ return name + weight;
+
+
+ }
+}
diff --git a/src/main/java/hw15/Produce.java b/src/main/java/hw15/Produce.java
new file mode 100644
index 0000000..8c335d0
--- /dev/null
+++ b/src/main/java/hw15/Produce.java
@@ -0,0 +1,11 @@
+package hw15;
+
+public class Produce extends Food{
+ public String store;
+
+ public Produce(String name, int weight, String store) {
+ super(name, weight);
+ this.store = store;
+ }
+}
+
diff --git a/src/main/java/hw15/Work15.java b/src/main/java/hw15/Work15.java
new file mode 100644
index 0000000..bf39bab
--- /dev/null
+++ b/src/main/java/hw15/Work15.java
@@ -0,0 +1,69 @@
+package hw15;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Work15 {
+ public static void main(String[] args) {
+
+ List book = new ArrayList<>();
+
+ Book b1 = new Book(201, "Kolobok", "Ushinsky", "Russia", 8);
+ Book b2 = new Book(202, "Repka", "Tolstoy", "Russia", 4);
+ Book b3 = new Book(203, "Masha & the Bear", "Kuzovkov", "Russia", 6);
+ Book b4 = new Book(204, "The Tale of Tsar Saltan", "Pushkin", "Russia", 10);
+
+ book.add(b1);
+ book.add(b2);
+ book.add(b3);
+ book.add(b4);
+ System.out.println(" I have 4 books: ");
+ for (Book b : book) {
+ System.out.println("\n ID -> " + b.id + "\n\t Name-> " + b.name + "\n\tAuhor -> " + b.author + "\n\tPublisher -> " + b.publisher + "\n\tQuantity -> " + b.quantity);
+ }
+ System.out.println("I read this book:");
+ book.remove(b1);
+ System.out.println(book.remove(1));
+
+
+ List levelEsl = new ArrayList<>();
+ levelEsl.add(1);
+ levelEsl.add(2);
+ levelEsl.add(3);
+ levelEsl.add(4);
+ levelEsl.add(5);
+
+ System.out.println("We have 5 Level ESL Classes:");
+ levelEsl.forEach(x -> System.out.println(x));
+ System.out.println("My level is ");
+ levelEsl.set(0, 6);
+ System.out.println(levelEsl.set(0, 6));
+ System.out.println(" I started from : ");
+ levelEsl.get(3);
+ System.out.println(levelEsl.get(3));
+ levelEsl.remove(0);
+ System.out.println(levelEsl.remove(0));
+
+ Food dood =new Food("Plov",2);
+ System.out.println("I am going to cook "+new Food("Plov",2));
+ Produce p1 = new Produce("Meat",1,"Walmart");
+ var p2=new Produce("Carrots",1,"Walmart");
+ var p3=new Produce("Oil",1,"Walmart");
+
+ List produce= new ArrayList<>();
+ produce.add(p1);
+ produce.add(p2);
+ produce.add(p3);
+ for (Produce p:produce) {
+ System.out.println(" Plov included : "+p.getName());
+ produce.set(0,p2);
+ System.out.println(produce);
+
+
+ }
+ }
+
+}
+//Создайте 3 ArrayList - String, Integer и произвольного класса (придумайте сами)
+// добавьте в каждый ArrayList по 4 элемента
+// попробуйте методы add/set/remove/get/foreach
diff --git a/src/main/java/hw16/Child.java b/src/main/java/hw16/Child.java
new file mode 100644
index 0000000..43a3614
--- /dev/null
+++ b/src/main/java/hw16/Child.java
@@ -0,0 +1,26 @@
+package hw16;
+
+public class Child {
+ private double age;
+
+ public Child(double age) {
+ this.age = age;
+ }
+
+
+ public double getAge() {
+ return age;
+ }
+
+ public void setAge(double age) {
+ this.age = age;
+ }
+
+ @Override
+ public String toString() {
+ return "Child" +
+ " age=" + age ;
+ }
+}
+
+
diff --git a/src/main/java/hw16/DayCare.java b/src/main/java/hw16/DayCare.java
new file mode 100644
index 0000000..8aa8d8c
--- /dev/null
+++ b/src/main/java/hw16/DayCare.java
@@ -0,0 +1,25 @@
+package hw16;
+
+public class DayCare {
+ public String name;
+
+
+ public DayCare(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name ;
+ }
+}
+
+
diff --git a/src/main/java/hw16/Work16.java b/src/main/java/hw16/Work16.java
new file mode 100644
index 0000000..97912c1
--- /dev/null
+++ b/src/main/java/hw16/Work16.java
@@ -0,0 +1,80 @@
+package hw16;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Work16 {
+ public static void main(String[] args) {
+ Map business = new HashMap<>();
+ business.put("Sales", "lifeblood");
+ business.put("Marketing", "advertising");
+ business.put("Finance", "budget");
+ business.put("Accounting", "managing");
+ System.out.println(business);
+ System.out.println(business.size());
+ business.replace("Sales", "MONEY");
+ System.out.println(business);
+ business.remove("Finance");
+ System.out.println(business);
+ business.get("Sales");
+ System.out.println("I like " + business.get("Sales") + " )) .");
+ for (String key : business.keySet()) {
+ System.out.println(key);
+ }
+ for (Map.Entry kv : business.entrySet()) {
+ System.out.println(kv.getValue());
+ }
+ Map tvBest = new HashMap<>();
+ tvBest.put(90, "Samsung");
+ tvBest.put(2, "LG");
+ tvBest.put(950, "Sony");
+ tvBest.put(9, "Hisense");
+ System.out.println(tvBest);
+ tvBest.replace(9, "Toshiba");
+ System.out.println("I don't like " + tvBest.replace(9, "Toshiba"));
+ tvBest.remove(950, "Sony");
+ System.out.println(tvBest);
+ tvBest.get(9);
+ System.out.println("I never used " + tvBest.get(9));
+ for (Map.Entry tv : tvBest.entrySet()) {
+ System.out.println(tv.getValue());
+ System.out.println(tv.getKey());
+ }
+ DayCare d1 = new DayCare("Primrose");
+ var d2 = new DayCare("Montessory");
+ var d3 = new DayCare("Academic");
+ var d4 = new DayCare("Robotic");
+
+ Child c1 = new Child(1.5);
+ var c2 = new Child(2.5);
+ var c3 = new Child(3.0);
+ var c4 = new Child(4.5);
+
+ Map kinder = new HashMap<>();
+ kinder.put(d1, c1);
+ kinder.put(d2, c2);
+ kinder.put(d3, c3);
+ kinder.put(d4, c4);
+ for (Map.Entry kv : kinder.entrySet()) {
+ System.out.println(kv.getKey());
+ System.out.println(kv.getValue());
+ }
+ kinder.remove(d4);
+ System.out.println(kinder.size());
+
+ for (DayCare key1 : kinder.keySet()) {
+ System.out.println(key1);
+ }
+ kinder.replace(d1, c3);
+ System.out.println(kinder);
+ kinder.get(c3);
+ System.out.println(kinder.getOrDefault(c3, c3));
+
+
+ }
+}
+
+//Создайте 3 HashMap- , и произвольного класса (придумайте сами)
+// добавьте в каждый HashMap по 4 элемента
+// попробуйте методы put/replace/remove/get/foreach
diff --git a/src/main/java/hw7/Work.java b/src/main/java/hw7/Work.java
new file mode 100644
index 0000000..7a20763
--- /dev/null
+++ b/src/main/java/hw7/Work.java
@@ -0,0 +1,58 @@
+package hw7;
+
+import java.util.Arrays;
+
+public class Work {
+ public static void main(String[] args) {
+ int[] arr1 = {1,4,9,9};
+ System.out.println(sum(arr1));
+
+ int[] arr2 = {55,63,11,11,21,231,234,121,456,789,0,3546,345,33232};
+ System.out.println(sum(arr2));
+
+ int[] arr3 = {0};
+ System.out.println(sum(arr3));
+
+ sort(arr1);
+ sort(arr2);
+ sort(arr3);
+
+ System.out.println();
+ System.out.println("min = "+ min_max(arr1)[0] + ", max = "+ min_max(arr1)[1]);
+ System.out.println("min = "+ min_max(arr2)[0] + ", max = "+ min_max(arr2)[1]);
+ System.out.println("min = "+ min_max(arr3)[0] + ", max = "+ min_max(arr3)[1]);
+ }
+
+ public static int[] min_max(int[]arr){
+ int min = arr[0];
+ int max = arr[0];
+
+ for (int v:arr){
+ if(v>max){
+ max=v;
+ }
+ if(v=0; i--){
+ System.out.print(arr[i]+" ");
+ }
+// for (int v:arr){
+// System.out.print(v+" ");
+// }
+ }
+ public static int sum(int[] arr){
+ int sum = 0;
+ for(int v:arr){
+ sum=sum+v;
+ }
+ return sum;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/hw9/Clothing.java b/src/main/java/hw9/Clothing.java
new file mode 100644
index 0000000..03fd5ba
--- /dev/null
+++ b/src/main/java/hw9/Clothing.java
@@ -0,0 +1,13 @@
+package hw9;
+
+public class Clothing {
+ public String brand;
+ public String type;
+ public String color;
+ public int size;
+ public double price;
+
+ public void printinfo(){
+ System.out.println(brand + " is an Italian luxury.");
+ }
+}
diff --git a/src/main/java/hw9/Dish.java b/src/main/java/hw9/Dish.java
new file mode 100644
index 0000000..ada7958
--- /dev/null
+++ b/src/main/java/hw9/Dish.java
@@ -0,0 +1,12 @@
+package hw9;
+
+public class Dish {
+ public String mean;
+ public String main;
+ public double recipe;
+ public String taste;
+
+ public void like (){
+ System.out.println(mean+ "slice of meat cut from the part of beef.");
+ }
+}
diff --git a/src/main/java/hw9/Place.java b/src/main/java/hw9/Place.java
new file mode 100644
index 0000000..665547f
--- /dev/null
+++ b/src/main/java/hw9/Place.java
@@ -0,0 +1,15 @@
+package hw9;
+
+public class Place {
+ public String country;
+ public String capital;
+ public double population;
+ public String nationality;
+ public String language;
+
+ public void printinfo(){
+ System.out.println("\nCountry -> "+country+ "\n\tCapital -> "+capital +"\n\tPopulation -> "+population+
+ "\n\tNationality ->"+nationality+"\n\tLanguage -> "+language );
+ }
+
+}
diff --git a/src/main/java/hw9/Resume.java b/src/main/java/hw9/Resume.java
new file mode 100644
index 0000000..c54d7af
--- /dev/null
+++ b/src/main/java/hw9/Resume.java
@@ -0,0 +1,13 @@
+package hw9;
+
+public class Resume {
+ public String name;
+ public int age;
+ public String residence;
+ public String job;
+ public String hobby;
+
+ public void learn(){
+ System.out.println(" Now"+ name + " is learning Java.");
+ }
+}
diff --git a/src/main/java/hw9/app.java b/src/main/java/hw9/app.java
new file mode 100644
index 0000000..aed4a7a
--- /dev/null
+++ b/src/main/java/hw9/app.java
@@ -0,0 +1,90 @@
+package hw9;
+
+public class app {
+ public static void main(String[] args) {
+ Resume myself = new Resume();
+ myself.name = " Nasyikat";
+ myself.age = 41;
+ myself.residence = "Texas";
+ myself.job = "accountant";
+ myself.hobby = "cooking ";
+
+ var friend = new Resume();
+ friend.name = "Aika";
+ friend.age = 43;
+ friend.residence = "Kyrgyzstan";
+ friend.job = "lawyer";
+ friend.hobby = "yoga";
+
+ System.out.println("My name is " + myself.name + "." + " I am " + myself.age + "." + " I live in " +
+ myself.residence + "." + " My job was an " + myself.job + "." + " I am " + myself.hobby + "every day" + " .");
+
+ myself.learn();
+
+ System.out.println(" My friend is " + friend.name + "." + " She is from " + friend.residence + "."
+ + friend.name + " works like as a" + friend.job + " and to do " + friend.hobby + ".");
+
+ Place kyrgyz = new Place();
+ kyrgyz.country = " Kyrgyzstan";
+ kyrgyz.capital = "Bishkek";
+ kyrgyz.population = 6.389500;
+ kyrgyz.nationality = " kyrgyz";
+ kyrgyz.language = "kyrgyz & russian";
+
+ var america = new Place();
+ america.country = " USA ";
+ america.capital = "Washington";
+ america.population = 329.000045;
+ america.nationality = "american";
+ america.language = "english & spanish";
+
+ if (kyrgyz.population < america.population) {
+ System.out.println("Kyrgyzstan is small");
+ } else {
+ System.out.println("America is small");
+ }
+ america.printinfo();
+
+ kyrgyz.printinfo();
+
+ Clothing some = new Clothing();
+ some.brand = " GICCI";
+ some.type = " coat";
+ some.color = " multi";
+ some.size = 16;
+ some.price = 2999.99;
+
+ var other = new Clothing();
+ other.brand = "NIKE";
+ other.type = "sport";
+ other.color = "white";
+ other.size = 8;
+ other.price = 299.99;
+
+ if (some.price > other.price) {
+ System.out.println("It is too expensive!");
+ } else {
+ System.out.println("I will buy this!");
+ }
+ some.printinfo();
+
+ Dish meal = new Dish();
+ meal.mean = " This food was a ";
+ meal.main = "Steak";
+ meal.recipe = 1.7;
+ meal.taste = "grilled";
+
+ var drink = new Dish();
+ drink.mean = "Juice";
+ drink.main = "apple";
+ drink.recipe = 2.5;
+ drink.taste = "Sweet";
+
+ System.out.println(meal.mean + " " + meal.main + "." + "I ordered " + meal.recipe + " pound" + "."
+ + "It tasted " + meal.taste + " .");
+
+ meal.like();
+ }
+}
+
+
diff --git a/src/main/java/hwr16/Address.java b/src/main/java/hwr16/Address.java
new file mode 100644
index 0000000..f1b0422
--- /dev/null
+++ b/src/main/java/hwr16/Address.java
@@ -0,0 +1,57 @@
+package hwr16;
+
+public class Address {
+ private String streetAddress;
+ private String town;
+ private String state;
+ private int zip;
+
+ public Address(String streetAddress, String town, String state, int zip) {
+ this.streetAddress = streetAddress;
+ this.town = town;
+ this.state = state;
+ this.zip = zip;
+ }
+ public Address() {
+ }
+
+ public String getStreetAddress() {
+ return streetAddress;
+ }
+
+ public void setStreetAddress(String streetAddress) {
+ this.streetAddress = streetAddress;
+ }
+
+ public String getTown() {
+ return town;
+ }
+
+ public void setTown(String town) {
+ this.town = town;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public int getZip() {
+ return zip;
+ }
+
+ public void setZip(int zip) {
+ this.zip = zip;
+ }
+
+ @Override
+ public String toString() {
+ return " Address: " + streetAddress + '\'' +
+ ", town='" + town + '\'' +
+ ", state='" + state + '\'' +
+ ", zip=" + zip;
+ }
+}
diff --git a/src/main/java/hwr16/Doctor.java b/src/main/java/hwr16/Doctor.java
new file mode 100644
index 0000000..65482a9
--- /dev/null
+++ b/src/main/java/hwr16/Doctor.java
@@ -0,0 +1,43 @@
+package hwr16;
+
+public class Doctor {
+ private String name;
+ private String lastName;
+ private Position position;
+
+ public Doctor(String name, String lastName, Position position) {
+ this.name = name;
+ this.lastName = lastName;
+ this.position = position;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public Position getPosition() {
+ return position;
+ }
+
+ public void setPosition(Position position) {
+ this.position = position;
+ }
+
+ @Override
+ public String toString() {
+ return name +" " + lastName+" "+"= " + position ;
+ }
+}
+
diff --git a/src/main/java/hwr16/Hospital.java b/src/main/java/hwr16/Hospital.java
new file mode 100644
index 0000000..8a332af
--- /dev/null
+++ b/src/main/java/hwr16/Hospital.java
@@ -0,0 +1,35 @@
+package hwr16;
+
+public class Hospital {
+ private String hospitalName;
+ private Address address;
+
+ public Hospital(String hospitalName, Address address) {
+ this.hospitalName = hospitalName;
+ this.address = address;
+ }
+
+ public String getHospitalName() {
+ return hospitalName;
+ }
+
+ public void setHospitalName(String hospitalName) {
+ this.hospitalName = hospitalName;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ @Override
+ public String toString() {
+ return hospitalName + address ;
+ }
+
+
+ }
+
diff --git a/src/main/java/hwr16/InsuranceCompanies.java b/src/main/java/hwr16/InsuranceCompanies.java
new file mode 100644
index 0000000..c8ea684
--- /dev/null
+++ b/src/main/java/hwr16/InsuranceCompanies.java
@@ -0,0 +1,9 @@
+package hwr16;
+
+public enum InsuranceCompanies {
+ Aetna,
+ Cigna,
+ Humana,
+ Ambetter
+
+}
diff --git a/src/main/java/hwr16/Position.java b/src/main/java/hwr16/Position.java
new file mode 100644
index 0000000..44e00fc
--- /dev/null
+++ b/src/main/java/hwr16/Position.java
@@ -0,0 +1,10 @@
+package hwr16;
+
+public enum Position {
+ Physician,
+ Pediatrician,
+ Surgeon,
+ Cardiologist,
+ Dermatologist
+
+}
diff --git a/src/main/java/hwr16/Work162.java b/src/main/java/hwr16/Work162.java
new file mode 100644
index 0000000..af933c5
--- /dev/null
+++ b/src/main/java/hwr16/Work162.java
@@ -0,0 +1,64 @@
+package hwr16;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Work162 {
+ public static void main(String[] args) {
+ Doctor doctor1 = new Doctor("Oleg", "Petrov", Position.Cardiologist);
+ var doctor2 = new Doctor("Igor", "Ivanov", Position.Dermatologist);
+ var doctor3 = new Doctor("Dan", "Asanov", Position.Pediatrician);
+ var doctor4 = new Doctor("Nastya", "Okinova", Position.Surgeon);
+ var doctor5 = new Doctor("Asel", "Akunova", Position.Physician);
+ List doctors = new ArrayList<>();
+ doctors.add(doctor1);
+ doctors.add(doctor2);
+ doctors.add(doctor3);
+ doctors.add(doctor4);
+ doctors.add(doctor5);
+ System.out.println(doctors);
+ System.out.println("----------------------------------------------------------------------");
+
+ Map rooms = new HashMap<>();
+ rooms.put(21, "Cardiologist");
+ rooms.put(22, "Dermatologist");
+ rooms.put(23, "Pediatrician");
+ rooms.put(24, "Surgeon");
+ rooms.put(25, "Physician");
+ for (Map.Entry r : rooms.entrySet()) {
+ System.out.println(r.getValue() + " " + "rooms # " + r.getKey());
+ }
+ System.out.println("-------------------------------------------------------------------");
+ Address a1 = new Address("2828 Long Reach dr", "Sugar Land", "TX", 77479);
+ Address a2 = new Address("4747 LJ Pkwy", "Houston", "Texas", 77071);
+ Address a3 = new Address("8080 Hwy 6 ", "Conroe", "TX", 77459);
+ Address a4 = new Address("5858 New Territory blvd", "Dallas", "TX", 77050);
+
+ Hospital h1 = new Hospital("Memorial", a1);
+ Hospital h2 = new Hospital("Methodist", a2);
+ Hospital h3 = new Hospital("Heart Center", a3);
+ Hospital h4 = new Hospital("Atrium", a4);
+
+ Map info = new HashMap<>();
+ info.put(h1, InsuranceCompanies.Aetna);
+ info.put(h2, InsuranceCompanies.Ambetter);
+ info.put(h3, InsuranceCompanies.Cigna);
+ info.put(h4, InsuranceCompanies.Humana);
+ for (Map.Entry i : info.entrySet()) {
+ System.out.println("Hospital" + " " + i.getKey() + " " + " accepted Insuranses " + "' " + i.getValue() + "'");
+
+
+ }
+ }
+}
+
+
+// pivate HashMap rooms; (список кабинетов и их название - пример комната 22 - Gastroenterology rooms.put(22,"Gastroenterology") )
+// - private ArrayList acceptedInsuranses; список принимаемых страховок.
+// (Enum InsuranseCompamies - enum of Insuranses, например InsuranseCompamies.AETNA, InsuranseCompamies.UnitedHealthcare)
+// Методы:
+// - Вывести на печать название, адрес и список Иншурансов которые принимает больница - public void printInfo();
+// - Вывести на печать список врачей и их должности - public void printDoctors();
+// - Вывести на печать все кабинеты с номерами и их названиямиж
diff --git a/src/main/java/l15/App.java b/src/main/java/l15/App.java
index 69f90d1..8b1c53a 100644
--- a/src/main/java/l15/App.java
+++ b/src/main/java/l15/App.java
@@ -45,7 +45,7 @@ public static void main(String[] args) {
names.forEach(System.out::println);
- List people = new ArrayList<>();
+// List people = new ArrayList<>();
// ArrayList xx = null;
// xx.add(23.6);
diff --git a/src/test/java/apiTest/NasApiCall.java b/src/test/java/apiTest/NasApiCall.java
new file mode 100644
index 0000000..7dd8ca4
--- /dev/null
+++ b/src/test/java/apiTest/NasApiCall.java
@@ -0,0 +1,42 @@
+package apiTest;
+import helpers.Token;
+import io.restassured.http.ContentType;
+import io.restassured.path.json.JsonPath;
+import io.restassured.response.Response;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import static io.restassured.RestAssured.given;
+
+public class NasApiCall {
+ private String token;
+
+ @BeforeMethod
+ public void init() {
+ token = Token.retrieveToken("abc@xyz.com", "Testtest123!");
+ }
+
+ @Test
+ public void bookTest() {
+
+ Response response =
+ given()
+ .baseUri("http://booklibrarywebapidev.azurewebsites.net/")
+ .header("Authorization", "Bearer " + token)
+ .basePath("api/books/id/802")
+
+ .contentType(ContentType.JSON)
+ .when()
+ .get()
+ .then()
+ .statusCode(200)
+ .extract()
+ .response();
+
+ JsonPath jsonPath = response.jsonPath();
+ System.out.println(jsonPath.prettify());
+ }
+}
+
+
+
+
diff --git a/src/test/java/apiTest/PlaylistTestDb.java b/src/test/java/apiTest/PlaylistTestDb.java
new file mode 100644
index 0000000..b7cbc71
--- /dev/null
+++ b/src/test/java/apiTest/PlaylistTestDb.java
@@ -0,0 +1,71 @@
+package apiTest;
+
+import com.google.gson.Gson;
+import helpers.Data;
+import helpers.DbAdapter;
+import helpers.TestData;
+import helpers.Token;
+import io.restassured.http.ContentType;
+import io.restassured.path.json.JsonPath;
+import io.restassured.response.Response;
+import models.CreatePlaylistRequest;
+import models.CreatePlaylistResponse;
+import models.Playlist;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+
+import java.sql.SQLException;
+
+import static io.restassured.RestAssured.given;
+
+public class PlaylistTestDb {
+ private int playlist_id;
+ private String token;
+ @BeforeMethod
+ public void startUp(){
+ token= Token.retrieveToken("testpro.user02@testpro.io","te$t$tudent02");
+ }
+ @AfterMethod
+ public void tearDown(){
+ Response response = given()
+ .baseUri("https://koelapp.testpro.io/")
+ .header("Authorization","Bearer "+token)
+ .basePath("api/playlist/"+playlist_id)
+ .when()
+ .delete();
+ }
+ @Test
+ public void playlistTestsDb_CreatePlaylist_PlaylistCreated() throws SQLException {
+ String playlistName = TestData.randomString();
+ String[] rules = {};
+ var createplaylist = new CreatePlaylistRequest(playlistName,rules);
+ var requestBody = new Gson().toJson(createplaylist);
+
+ Response response = given()
+ .baseUri("https://koelapp.testpro.io/")
+ .header("Authorization","Bearer "+token)
+ .basePath("api/playlist")
+ .contentType(ContentType.JSON)
+ .body(requestBody)
+ .when()
+ .post()
+ .then()
+ .statusCode(200)
+ .extract()
+ .response();
+
+ JsonPath jsonPath = response.jsonPath();
+ CreatePlaylistResponse createdPlaylist = jsonPath.getObject("$",CreatePlaylistResponse.class);
+ playlist_id=createdPlaylist.id;
+ Assert.assertEquals(createplaylist.name,createdPlaylist.name);
+ Assert.assertEquals(createdPlaylist.songs.length,0);
+ Playlist playlist= DbAdapter.getAllPlaylistById(playlist_id);
+ Assert.assertNotNull(playlist,"Object not found in DB");
+
+
+ Assert.assertEquals(playlistName,playlist.name);
+ }
+}
diff --git a/src/test/java/apiTest/TestDb.java b/src/test/java/apiTest/TestDb.java
new file mode 100644
index 0000000..11cdea0
--- /dev/null
+++ b/src/test/java/apiTest/TestDb.java
@@ -0,0 +1,26 @@
+package apiTest;
+
+import helpers.DbAdapter;
+import models.Playlist;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.sql.SQLException;
+
+public class TestDb {
+ @Test
+ public void getArists_ListOfArtistReturned() throws SQLException {
+ DbAdapter.getArtists();
+ }
+
+ @Test
+ public void getPlaylists_ListOfPlaylists_returned() throws SQLException {
+ DbAdapter.getAllPlaylist();
+ }
+
+ @Test
+ public void getSinglePlaylistById() throws SQLException {
+ Playlist pl =DbAdapter.getAllPlaylistById(19);
+ Assert.assertEquals(pl.name,"Dima");
+ }
+}
diff --git a/src/test/java/browserFactory/BrowserFactory.java b/src/test/java/browserFactory/BrowserFactory.java
index f0922c2..b7acbd4 100644
--- a/src/test/java/browserFactory/BrowserFactory.java
+++ b/src/test/java/browserFactory/BrowserFactory.java
@@ -43,7 +43,7 @@ private static WebDriver getFirefoxDriver() {
FirefoxOptions options = new FirefoxOptions();
options.addArguments("--width=1400");
options.addArguments("--height=1000");
- options.addArguments("--headless");
+// options.addArguments("--headless");
System.setProperty("webdriver.gecko.driver","geckodriver.exe");
return new FirefoxDriver(options);
}
diff --git a/src/test/java/helpers/DbAdapter.java b/src/test/java/helpers/DbAdapter.java
new file mode 100644
index 0000000..9c73766
--- /dev/null
+++ b/src/test/java/helpers/DbAdapter.java
@@ -0,0 +1,118 @@
+package helpers;
+
+import models.Artist;
+import models.Playlist;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DbAdapter {
+ static final String JDBC_DRIVER = "org.mariadb.jdbc.Driver";
+ static final String USER = "dbuser02";
+ static final String PASS = "pa$$02";
+ static final String DB_URL = "jdbc:mariadb://koelapp.testpro.io/dbkoel";
+
+ static Connection conn = null;
+ static Statement stmt = null;
+
+
+ public static List getArtists() throws SQLException {
+ List artists =new ArrayList();
+ try {
+ Class.forName(JDBC_DRIVER);
+ conn = DriverManager.getConnection(DB_URL, USER, PASS);
+ //STEP 4: Execute a query
+ stmt = conn.createStatement();
+
+ String sqlQuery = "SELECT*FROM artists a ";
+
+ ResultSet rs = stmt.executeQuery(sqlQuery);
+ while (rs.next()) {
+ String name = rs.getString("name");
+ int id=rs.getInt("id");
+
+ Artist artist =new Artist(id,name);
+ artists.add(artist);
+ }
+ } catch (SQLException | ClassNotFoundException err) {
+ //Handle errors for JDBC
+ err.printStackTrace();
+
+ } finally {
+ //finally block used to close resources
+
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ return artists;
+ }
+ public static List getAllPlaylist() throws SQLException {
+ List playlists =new ArrayList();
+ try {
+ Class.forName(JDBC_DRIVER);
+ conn = DriverManager.getConnection(DB_URL, USER, PASS);
+ //STEP 4: Execute a query
+ stmt = conn.createStatement();
+
+ String sqlQuery = "SELECT*FROM playlist ";
+
+ ResultSet rs = stmt.executeQuery(sqlQuery);
+ while (rs.next()) {
+ String name = rs.getString("name");
+ int id=rs.getInt("id");
+
+ Playlist playlist =new Playlist(id,name);
+ playlists.add(playlist);
+ }
+ } catch (SQLException | ClassNotFoundException err) {
+ //Handle errors for JDBC
+ err.printStackTrace();
+
+ } finally {
+ //finally block used to close resources
+
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ return playlists;
+ }
+ public static Playlist getAllPlaylistById(int id) throws SQLException {
+ Playlist returnedPlaylist =new Playlist();
+ try {
+ Class.forName(JDBC_DRIVER);
+ conn = DriverManager.getConnection(DB_URL, USER, PASS);
+ //STEP 4: Execute a query
+ stmt = conn.createStatement();
+
+ String sqlQuery = "SELECT id,name FROM playlists WHERE id= "+id;
+ List pls=new ArrayList<>();
+
+ ResultSet rs = stmt.executeQuery(sqlQuery);
+ while (rs.next()) {
+ String name = rs.getString("name");
+
+
+ Playlist playlist =new Playlist(id,name);
+ pls.add(playlist);
+ }
+ if (pls.size()==0){
+ return null;
+ }
+ returnedPlaylist=pls.get(0);
+ } catch (SQLException | ClassNotFoundException err) {
+ //Handle errors for JDBC
+ err.printStackTrace();
+
+ } finally {
+ //finally block used to close resources
+
+ if (conn != null) {
+ conn.close();
+ }
+ }
+ return returnedPlaylist;
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/helpers/Token.java b/src/test/java/helpers/Token.java
index cbb507e..595e0fd 100644
--- a/src/test/java/helpers/Token.java
+++ b/src/test/java/helpers/Token.java
@@ -16,8 +16,8 @@ public static String retrieveToken(String login, String pwd){
var requestBody = new Gson().toJson(credentials);
Response response = given()
- .baseUri("https://koelapp.testpro.io/")
- .basePath("api/me")
+ .baseUri("http://booklibrarywebapidev.azurewebsites.net/")
+ .basePath("api/books")
.contentType(ContentType.JSON)
.body(requestBody)
.when()
@@ -27,6 +27,18 @@ public static String retrieveToken(String login, String pwd){
.extract()
.response();
+// Response response = given()
+// .baseUri("https://koelapp.testpro.io/")
+// .basePath("api/me")
+// .contentType(ContentType.JSON)
+// .body(requestBody)
+// .when()
+// .post()
+// .then()
+// .statusCode(200)
+// .extract()
+// .response();
+
JsonPath jsonPath = response.jsonPath();
var responseBody = jsonPath.getObject("$", TokenResponse.class);
token = responseBody.token;
diff --git a/src/test/java/models/Artist.java b/src/test/java/models/Artist.java
index d07264d..fd360b1 100644
--- a/src/test/java/models/Artist.java
+++ b/src/test/java/models/Artist.java
@@ -3,4 +3,8 @@
public class Artist {
public int id;
public String name;
+
+ public Artist(int id, String name) {
+
+ }
}
diff --git a/src/test/java/models/Playlist.java b/src/test/java/models/Playlist.java
index 07d1deb..e039ae8 100644
--- a/src/test/java/models/Playlist.java
+++ b/src/test/java/models/Playlist.java
@@ -5,4 +5,14 @@ public class Playlist {
public String name;
public String[] rules;
public boolean is_smart;
+
+ public Playlist(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public Playlist() {
+
+ }
}
+
diff --git a/src/test/java/pageObjects/BasePage.java b/src/test/java/pageObjects/BasePage.java
index 778bef4..6b7f2cc 100644
--- a/src/test/java/pageObjects/BasePage.java
+++ b/src/test/java/pageObjects/BasePage.java
@@ -25,4 +25,7 @@ public BasePage(WebDriver driver) {
.ignoring(StaleElementReferenceException.class)
.ignoring(NoSuchElementException.class);
}
-}
+
+
+
+ }
diff --git a/src/test/java/pageObjects/HomePageSelectors.java b/src/test/java/pageObjects/HomePageSelectors.java
index aeb8949..a0e221c 100644
--- a/src/test/java/pageObjects/HomePageSelectors.java
+++ b/src/test/java/pageObjects/HomePageSelectors.java
@@ -3,5 +3,6 @@
public class HomePageSelectors {
public static final String homeButtonXpath = "//*[@class='home active']";
public static final String plusButtonCssSelector = ".fa.fa-plus-circle";
- public static final String newPlaylistFieldXpath = "//*[@class='create']/*";
+ public static final String newPlaylistFieldXpath = "//*[@class='777create']/*";
+// public static final String addMyPlaylistXpath= "//* [@class=\"btn btn-green btn-add-to\"]";
}
diff --git a/src/test/java/pageObjects/LoginPage.java b/src/test/java/pageObjects/LoginPage.java
index 1634d85..b8217db 100644
--- a/src/test/java/pageObjects/LoginPage.java
+++ b/src/test/java/pageObjects/LoginPage.java
@@ -11,8 +11,11 @@ public class LoginPage extends BasePage{
public LoginPage(WebDriver driver) {
super(driver);
+
}
+
+
public void openPage(){
driver.get(url);
}
diff --git a/src/test/java/tests/HWTest.java b/src/test/java/tests/HWTest.java
new file mode 100644
index 0000000..f83c22d
--- /dev/null
+++ b/src/test/java/tests/HWTest.java
@@ -0,0 +1,30 @@
+//package tests;
+//
+//import org.testng.Assert;
+//import org.testng.annotations.Test;
+//import pageObjects.HomePage;
+//import pageObjects.LoginPage;
+//
+//public class HWTest extends BaseTest {
+// @Test
+// public void new_loginTest_createNewPlaylist_newPlaylistCreated() {
+// LoginPage loginPage = new LoginPage(driver);
+// loginPage.openPage();
+// HomePage homePage = loginPage.login("testpro.user02@testpro.io", "te$t$tudent02");
+// homePage.createNewPlaylist("Nasyikat");
+// Assert.assertTrue(homePage.isPlaylistCreated("Nasyikat"));
+// }
+//
+// @Test
+// public void scrollDown() {
+// LoginPage loginPage = new LoginPage(driver);
+// loginPage.openPage();
+// HomePage homePage = loginPage.login("testpro.user02@testpro.io", "te$t$tudent02");
+// homePage.createNewPlaylist("Nasyikat");
+// homePage.leftHandScrollDown("Nasyikat");
+// homePage.renamePlayList("Nasyikat", "Nasu");
+// Assert.assertTrue(homePage.isPlaylistCreated("Nasu"));
+// }
+//
+// }
+
diff --git a/src/test/java/tests/LoginTests.java b/src/test/java/tests/LoginTests.java
index 95fe41c..454eac8 100644
--- a/src/test/java/tests/LoginTests.java
+++ b/src/test/java/tests/LoginTests.java
@@ -9,55 +9,45 @@
import pageObjects.LoginPage;
-public class LoginTests extends BaseTest{
-
- @Parameters({"email","password"})
+public class LoginTests extends BaseTest {
+ @Parameters({"email", "password"})
@Test
- public void loginTest_correctCredentials_loggedToApp(String login, String pwd){
+ public void loginTest_correctCredentials_loggedToApp(String login, String pwd) {
LoginPage loginPage = new LoginPage(driver);
loginPage.openPage();
- HomePage homePage = loginPage.login(login,pwd);
+ HomePage homePage = loginPage.login(login, pwd);
Assert.assertTrue(homePage.isHomepage());
}
- @Parameters({"email","wrong-password"})
+
+ @Parameters({"email", "wrong-password"})
@Test(retryAnalyzer = RetryAnalyzer.class)
- public void loginTest_incorrectCredentials_notLoggedToApp(String login, String pwd){
+ public void loginTest_incorrectCredentials_notLoggedToApp(String login, String pwd) {
LoginPage loginPage = new LoginPage(driver);
loginPage.openPage();
- loginPage.login(login,pwd);
+ loginPage.login(login, pwd);
Assert.assertTrue(loginPage.isError());
}
- @Test (retryAnalyzer = RetryAnalyzer.class, enabled = false)
- public void test_Fails(){
+
+ @Test(retryAnalyzer = RetryAnalyzer.class, enabled = false)
+ public void test_Fails() {
Assert.assertTrue(false);
}
+
@DataProvider(name = "Summing")
- public Object[][] createData1() {
- return new Object[][] {
- { 3, 3, 6 },
- { 2,8,10},
- {10,12,22},
- {58,3,61},
- {5,6,10},
- {-10,-15,-25}
+ public static Object[][] createData() {
+ return new Object[][]{
+ {3, 3, 6},
+ {2, 8, 10},
+ {10, 12, 22},
+ {58, 3, 61},
+ {-10, -15, -25}
};
}
+
@Test(dataProvider = "Summing")
- public void test_Sum(int a, int b, int c){
+ public void test_Sum(int a, int b, int c) {
int xx = a + b;
- Assert.assertEquals(xx,c);
- }
- @DataProvider(name = "StringSumming")
- public Object[][] createData2() {
- return new Object[][] {
- {"ST","ing","STing"},
- {"5","6","11"},
- {"55","6","556"}
- };
- }
- @Test(dataProvider = "StringSumming")
- public void test_StringSum(String a, String b, String c){
- String xx = a + b;
- Assert.assertEquals(xx,c);
+ Assert.assertEquals(xx, c);
}
+
}