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/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..74a90eb
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..8f47e5a
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/java-course.iml b/.idea/java-course.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/java-course.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..aa2dbf0
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..edb5d78
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ 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/JavaCourse/src/main/java/com/rinftech/animals/DomesticAnimal.java b/JavaCourse/src/main/java/com/rinftech/animals/DomesticAnimal.java
index 4f20f0d..096ab94 100644
--- a/JavaCourse/src/main/java/com/rinftech/animals/DomesticAnimal.java
+++ b/JavaCourse/src/main/java/com/rinftech/animals/DomesticAnimal.java
@@ -1,6 +1,6 @@
package com.rinftech.animals;
-import jdk.nashorn.internal.codegen.CompilerConstants;
+//import jdk.nashorn.internal.codegen.CompilerConstants;
import java.util.Objects;
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Employee.java b/JavaCourse/src/main/java/com/rinftech/collections/Employee.java
new file mode 100644
index 0000000..f72b6cf
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Employee.java
@@ -0,0 +1,29 @@
+package com.rinftech.collections;
+
+public class Employee extends Person {
+ private Integer employeeId;
+
+ private String title;
+
+
+ public Employee() {
+ }
+
+ public Employee(Integer employeeId, String title) {
+ this.employeeId = employeeId;
+ this.title = title;
+ }
+
+ public Integer getEmployeeId() {
+ return employeeId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ @Override
+ public String getLastName() {
+ return super.getLastName() + " is " + this.getTitle();
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Person.java b/JavaCourse/src/main/java/com/rinftech/collections/Person.java
new file mode 100644
index 0000000..f9ec0aa
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Person.java
@@ -0,0 +1,24 @@
+package com.rinftech.collections;
+
+public class Person {
+
+ private String firstName;
+ private String lastName;
+
+ public Person() {
+
+ }
+
+ public Person(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Probl10.java b/JavaCourse/src/main/java/com/rinftech/collections/Probl10.java
new file mode 100644
index 0000000..34ebaa8
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Probl10.java
@@ -0,0 +1,38 @@
+package com.rinftech.collections;
+
+import java.util.*;
+
+public class Probl10 {
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ try {
+// List array = readArray(scanner);
+// String color = scanner.nextLine();
+ List array = new ArrayList<>(Arrays.asList(
+ "eat", "tea", "tan", "ate", "nat", "bat", "listen", "silent", "enlist", "hello", "world", "dlrow"
+ ));
+ Map> result = groupAnagrams(array);
+ System.out.println(result.toString());
+ } catch (Exception e) {
+ System.out.println(e);
+ } finally {
+ scanner.close();
+ }
+ }
+
+ public static Map> groupAnagrams(List words) {
+ Map> anagramsMap = new HashMap<>();
+
+ for (String word : words) {
+ char[] chars = word.toCharArray();
+ Arrays.sort(chars);
+ String sortedWord = new String(chars);
+ if (!anagramsMap.containsKey(sortedWord)) {
+ anagramsMap.put(sortedWord, new ArrayList<>());
+ }
+ anagramsMap.get(sortedWord).add(word);
+ }
+
+ return anagramsMap;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Probl5.java b/JavaCourse/src/main/java/com/rinftech/collections/Probl5.java
new file mode 100644
index 0000000..be5c187
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Probl5.java
@@ -0,0 +1,47 @@
+package com.rinftech.collections;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+public class Probl5 {
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ try {
+ List firstArray = readArray(scanner);
+ List secondArray = readArray(scanner);
+ List result = findCommonElements(firstArray, secondArray);
+ System.out.println(result.toString());
+ }
+ catch (Exception e) {
+ System.out.println(e);
+ }
+ finally {
+ scanner.close();
+ }
+ }
+
+ public static List readArray(Scanner scanner) {
+ System.out.print("Enter the size of the array: ");
+ int size = scanner.nextInt();
+ scanner.nextLine();
+ List array = new ArrayList<>();
+ for (int i = 0; i < size; i++) {
+ System.out.print("Enter element " + (i + 1) + ": ");
+ array.add(scanner.nextLine());
+ }
+ return array;
+ }
+
+ public static List findCommonElements(List array1, List array2) {
+ List result = new ArrayList<>();
+ for (String element : array1) {
+ for (String element1 : array2) {
+ if (element.equals(element1)) {
+ result.add(element);
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Probl8.java b/JavaCourse/src/main/java/com/rinftech/collections/Probl8.java
new file mode 100644
index 0000000..2958b49
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Probl8.java
@@ -0,0 +1,43 @@
+package com.rinftech.collections;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+public class Probl8 {
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ try {
+ List array = readArray(scanner);
+ Integer pos1 = scanner.nextInt();
+ Integer pos2 = scanner.nextInt();
+
+ String element1 = array.get(pos1);
+ String element2 = array.get(pos2);
+
+ array.set(pos1, element2);
+ array.set(pos2, element1);
+
+ System.out.println(array.toString());
+ }
+ catch (Exception e) {
+ System.out.println(e);
+ }
+ finally {
+ scanner.close();
+ }
+ }
+
+ public static List readArray(Scanner scanner) {
+ System.out.print("Enter the size of the array: ");
+ int size = scanner.nextInt();
+ scanner.nextLine();
+ List array = new ArrayList<>();
+ for (int i = 0; i < size; i++) {
+ System.out.print("Enter element " + (i + 1) + ": ");
+ array.add(scanner.nextLine());
+ }
+ return array;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Problem9.java b/JavaCourse/src/main/java/com/rinftech/collections/Problem9.java
new file mode 100644
index 0000000..1ea111c
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Problem9.java
@@ -0,0 +1,41 @@
+package com.rinftech.collections;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+
+public class Problem9 {
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ try {
+// List array = readArray(scanner);
+// String color = scanner.nextLine();
+ List array = new ArrayList<>(Arrays.asList(
+ "Red", "Green", "Black", "White", "Pink",
+ "Green", "Green", "Black", "Yellow", "White"
+ ));
+ String color = "Green";
+ System.out.println("First position is " + array.indexOf(color));
+ System.out.println("Last position is " + array.lastIndexOf(color));
+ } catch (Exception e) {
+ System.out.println(e);
+ } finally {
+ scanner.close();
+ }
+ }
+
+ public static List readArray(Scanner scanner) {
+ System.out.print("Enter the size of the array: ");
+ int size = scanner.nextInt();
+ scanner.nextLine();
+ List array = new ArrayList<>();
+ for (int i = 0; i < size; i++) {
+ System.out.print("Enter element " + (i + 1) + ": ");
+ array.add(scanner.nextLine());
+ }
+ return array;
+ }
+
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/Problems.java b/JavaCourse/src/main/java/com/rinftech/collections/Problems.java
new file mode 100644
index 0000000..44443ed
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/Problems.java
@@ -0,0 +1,56 @@
+package com.rinftech.collections;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Scanner;
+
+public class Problems {
+ public static void main(String[] args) {
+ Integer number = 8733;
+ Integer answer1 = sumDigits(number);
+ System.out.println(answer1);
+
+// String input = "The quick brown fox jumps over 42 lazy dogs";
+ Scanner myObj = new Scanner(System.in);
+ System.out.println("Enter your input: ");
+
+ String input = myObj.nextLine();
+ Map answer2 = countLetters(input);
+ System.out.println(answer2);
+ }
+
+ public static Integer sumDigits(Integer number) {
+ Integer sum = 0;
+ while (number > 0) {
+ sum += number % 10;
+ number /= 10;
+ }
+ return sum;
+ }
+
+ public static Map countLetters(String input) {
+ Map result = new HashMap<>();
+ for (char c : input.toCharArray()) {
+ if (Character.isLetter(c)) {
+ if (!result.containsKey("Letters")) {
+ result.put("Letters", 1);
+ } else {
+ result.put("Letters", result.get("Letters") + 1);
+ }
+ } else if (Character.isWhitespace(c)) {
+ if (!result.containsKey("Spaces")) {
+ result.put("Spaces", 1);
+ } else {
+ result.put("Spaces", result.get("Spaces") + 1);
+ }
+ } else if (Character.isDigit(c)) {
+ if (!result.containsKey("Numbers")) {
+ result.put("Numbers", 1);
+ } else {
+ result.put("Numbers", result.get("Numbers") + 1);
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl4/Car.java b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Car.java
new file mode 100644
index 0000000..b7b5e29
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Car.java
@@ -0,0 +1,14 @@
+package com.rinftech.collections.probl4;
+
+public class Car extends Vehicle{
+ private Double maxSpeed = 160.;
+
+ public Double getMaximumSpeed() {
+ return this.maxSpeed;
+ }
+
+ @Override
+ public String toString() {
+ return "This is a car: " + super.toString();
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl4/Motorcycle.java b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Motorcycle.java
new file mode 100644
index 0000000..a1e763e
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Motorcycle.java
@@ -0,0 +1,15 @@
+package com.rinftech.collections.probl4;
+
+public class Motorcycle extends Vehicle{
+
+ private Double maxSpeed = 180.;
+
+ public Double getMaximumSpeed() {
+ return this.maxSpeed;
+ }
+
+ @Override
+ public String toString() {
+ return "This is a motorcycle: " + super.toString();
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl4/Truck.java b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Truck.java
new file mode 100644
index 0000000..1c9dad3
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Truck.java
@@ -0,0 +1,14 @@
+package com.rinftech.collections.probl4;
+
+public class Truck extends Vehicle{
+ private Double maxSpeed = 120.;
+
+ public Double getMaximumSpeed() {
+ return this.maxSpeed;
+ }
+
+ @Override
+ public String toString() {
+ return "This is a truck: " + super.toString();
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl4/Vehicle.java b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Vehicle.java
new file mode 100644
index 0000000..ac919d4
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl4/Vehicle.java
@@ -0,0 +1,61 @@
+package com.rinftech.collections.probl4;
+
+public abstract class Vehicle {
+ private String make;
+
+ private String model;
+
+ private Integer year;
+
+ private String fuelType;
+
+ public Double calculateFuelEfficiency(Double distance, Double fuelConsumed) {
+ return distance/fuelConsumed;
+ }
+
+ public Double calculateDistanceTraveled(Double time, Double speed) {
+ return time * speed;
+ }
+
+ public abstract Double getMaximumSpeed();
+
+ @Override
+ public String toString() {
+ return "make='" + make + '\'' +
+ ", model='" + model + '\'' +
+ ", year=" + year +
+ ", fuelType='" + fuelType;
+ }
+
+ public String getMake() {
+ return make;
+ }
+
+ public void setMake(String make) {
+ this.make = make;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ public Integer getYear() {
+ return year;
+ }
+
+ public void setYear(Integer year) {
+ this.year = year;
+ }
+
+ public String getFuelType() {
+ return fuelType;
+ }
+
+ public void setFuelType(String fuelType) {
+ this.fuelType = fuelType;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl6/Circle.java b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Circle.java
new file mode 100644
index 0000000..d9fcd2a
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Circle.java
@@ -0,0 +1,21 @@
+package com.rinftech.collections.probl6;
+
+public class Circle extends Shape{
+ private final Double PI = 3.14;
+
+ private Double diameter;
+
+ @Override
+ public Double calculateArea() {
+ Double halfDiameter = getDiameter() / 2;
+ return PI * halfDiameter * halfDiameter;
+ }
+
+ public Double getDiameter() {
+ return diameter;
+ }
+
+ public void setDiameter(Double diameter) {
+ this.diameter = diameter;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl6/Rectangle.java b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Rectangle.java
new file mode 100644
index 0000000..af8a9cc
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Rectangle.java
@@ -0,0 +1,19 @@
+package com.rinftech.collections.probl6;
+
+public class Rectangle extends Shape{
+ private Double length;
+
+ private Double height;
+ @Override
+ public Double calculateArea() {
+ return getHeight() * getLength();
+ }
+
+ public Double getLength() {
+ return length;
+ }
+
+ public Double getHeight() {
+ return height;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl6/Shape.java b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Shape.java
new file mode 100644
index 0000000..a211564
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Shape.java
@@ -0,0 +1,5 @@
+package com.rinftech.collections.probl6;
+
+public abstract class Shape {
+ public abstract Double calculateArea();
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl6/Triangle.java b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Triangle.java
new file mode 100644
index 0000000..ac1f81a
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl6/Triangle.java
@@ -0,0 +1,20 @@
+package com.rinftech.collections.probl6;
+
+public class Triangle extends Shape{
+ private Double base;
+
+ private Double height;
+
+ @Override
+ public Double calculateArea() {
+ return getBase() * getHeight() / 2;
+ }
+
+ public Double getBase() {
+ return base;
+ }
+
+ public Double getHeight() {
+ return height;
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl7/Animal.java b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Animal.java
new file mode 100644
index 0000000..4622325
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Animal.java
@@ -0,0 +1,12 @@
+package com.rinftech.collections.probl7;
+
+public class Animal {
+
+ public void eat() {
+ System.out.println("All animals eat!");
+ }
+
+ public void sound() {
+ System.out.println("All animals make sounds!");
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl7/Lion.java b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Lion.java
new file mode 100644
index 0000000..37e4a49
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Lion.java
@@ -0,0 +1,13 @@
+package com.rinftech.collections.probl7;
+
+public class Lion extends Animal{
+ @Override
+ public void eat() {
+ System.out.println("The lion is a carnivore, he eats meat.");
+ }
+
+ @Override
+ public void sound() {
+ System.out.println("Lion: Rooooar!");
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl7/Panther.java b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Panther.java
new file mode 100644
index 0000000..7b3e584
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Panther.java
@@ -0,0 +1,13 @@
+package com.rinftech.collections.probl7;
+
+public class Panther extends Animal{
+ @Override
+ public void eat() {
+ System.out.println("The panther is a carnivore, he also eats meat.");
+ }
+
+ @Override
+ public void sound() {
+ System.out.println("Panther: Miau!");
+ }
+}
diff --git a/JavaCourse/src/main/java/com/rinftech/collections/probl7/Tiger.java b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Tiger.java
new file mode 100644
index 0000000..38787d6
--- /dev/null
+++ b/JavaCourse/src/main/java/com/rinftech/collections/probl7/Tiger.java
@@ -0,0 +1,13 @@
+package com.rinftech.collections.probl7;
+
+public class Tiger extends Animal{
+ @Override
+ public void eat() {
+ System.out.println("The tiger is a carnivore, he also eats meat.");
+ }
+
+ @Override
+ public void sound() {
+ System.out.println("Tiger: Arrrr!");
+ }
+}