diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/lab-java-basics.iml b/.idea/lab-java-basics.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/.idea/lab-java-basics.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..462edb0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..505d07d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ 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/out/production/lab-java-basics/Employee.class b/out/production/lab-java-basics/Employee.class new file mode 100644 index 0000000..0298b8f Binary files /dev/null and b/out/production/lab-java-basics/Employee.class differ diff --git a/out/production/lab-java-basics/Intern.class b/out/production/lab-java-basics/Intern.class new file mode 100644 index 0000000..95dec65 Binary files /dev/null and b/out/production/lab-java-basics/Intern.class differ diff --git a/out/production/lab-java-basics/Main.class b/out/production/lab-java-basics/Main.class new file mode 100644 index 0000000..c7329a4 Binary files /dev/null and b/out/production/lab-java-basics/Main.class differ diff --git a/src/Employee.java b/src/Employee.java new file mode 100644 index 0000000..033cf49 --- /dev/null +++ b/src/Employee.java @@ -0,0 +1,50 @@ +public class Employee { + private String nameEmployee; + private int age; + private String positionEmployee; + private int salaryOfEmployee; + + + public Employee(String nameEmployee, int age, String positionEmployee, int salaryOfEmployee) { + this.nameEmployee = nameEmployee; + this.age = age; + this.positionEmployee = positionEmployee; + this.salaryOfEmployee = salaryOfEmployee; + } + + public String getNameEmployee() { + return nameEmployee; + } + + public int getSalaryOfEmployee() { + return salaryOfEmployee; + } + + public int getAge() { + return age; + } + + public String getPositionEmployee() { + return positionEmployee; + } + + public void printEmployee(){ + System.out.println("Here is the emplopyees : "); + } + + public void setNameEmployee(String nameEmployee) { + this.nameEmployee = nameEmployee; + } + + public void setAge(int age) { + this.age = age; + } + + public void setPositionEmployee(String positionEmployee) { + this.positionEmployee = positionEmployee; + } + + public void setSalaryOfEmployee(int salaryOfEmployee) { + this.salaryOfEmployee = salaryOfEmployee; + } +} diff --git a/src/Intern.java b/src/Intern.java new file mode 100644 index 0000000..d32cbbd --- /dev/null +++ b/src/Intern.java @@ -0,0 +1,27 @@ + class Intern extends Employee { + public Intern(String name, int age, String position, int salary) { + super(name, age, position, salary); + setSalary(20000); + + } + + @Override + public void setSalaryOfEmployee(int salary) { + super.setSalaryOfEmployee(salary); + } + + public void setSalary(int salary) { + final int MAXINTERNSALARY = 20000; + + if (getSalaryOfEmployee()>MAXINTERNSALARY){ + System.out.println("Presentation "+getNameEmployee()+" age of "+getAge()+" in the "+getPositionEmployee()+ + " has a salary "+ getSalaryOfEmployee()+" it is over the limit "); + + }else{ + System.out.println("Presentation "+getNameEmployee()+" age of "+getAge()+" in the "+getPositionEmployee()+ + " has a salary "+ getSalaryOfEmployee()+" it is normal limit "); + super.setSalaryOfEmployee(MAXINTERNSALARY); + } + + } + } diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..d65c7a8 --- /dev/null +++ b/src/Main.java @@ -0,0 +1,104 @@ +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class Main { + public static void main(String[] args) { + + String delimitation = "==========================================================="; + System.out.println(delimitation); + + int[] numbers = {10, 5, 20, 25, 30, 40}; + System.out.println("The numbers of the array are: " + Arrays.toString(numbers)); + + Arrays.sort(numbers); + System.out.println("The numbers of the array are after sorting : " + Arrays.toString(numbers)); + + int minValue = numbers[0]; + int maxValue = numbers[numbers.length - 1]; + int diffrence_Max_Min = maxValue - minValue; + int secondMinValue = numbers[1]; + + + System.out.println("Maximum value is: " + maxValue); + System.out.println("Minimum value is: " + minValue); + System.out.println("The diffrence between Maximum and Minimum value is: " + diffrence_Max_Min); + System.out.println("The second Minimum value is: " + secondMinValue); + + + System.out.println(delimitation); + System.out.println(""); + System.out.println("***The second method of resolving task 1 and 2 ***"); + System.out.println(""); + System.out.println(delimitation); + + int[] numberOfArray = {30, 25, 50, 95, 10, 65, 85, 70}; + System.out.println("The numbers of the array are: " + Arrays.toString(numberOfArray)); + + int max_Value = numberOfArray[0]; + int min_Value = numberOfArray[0]; + + + for (int i : numberOfArray) + if (i > max_Value) + max_Value = i; + + + System.out.println("Max value of the array is : " + max_Value); + + + for (int i : numberOfArray) + if (i < min_Value) + min_Value = i; + + + System.out.println("Min value of the array is : " + min_Value); + + int diffrence_Max_Min2 = max_Value - min_Value; + System.out.println("Diffrence of Max and Min of the array is : " + diffrence_Max_Min2); + System.out.println(delimitation); + + int secondNumber = numberOfArray[0]; + + for (int i : numberOfArray) + if (i < secondNumber && i > min_Value) + secondNumber = i; + + System.out.println("The second minimum value of the array is : " + secondNumber); + System.out.println(delimitation); + ArrayList employeesOfTheCompany = new ArrayList<>(); + employeesOfTheCompany.add(new Employee("Max", 41, "Site Manager", 100_000)); + employeesOfTheCompany.add(new Employee("Enis", 48, "Operation Manager OutBound", 80_000)); + employeesOfTheCompany.add(new Employee("Simon", 33, "Operation Manager Inbound", 75_000)); + employeesOfTheCompany.add(new Employee("Aslyan", 26, "Manager IB", 45_000)); + employeesOfTheCompany.add(new Intern("Alex", 35, " FC Associate IB ", 21_000)); + employeesOfTheCompany.add(new Intern("Ibrahim", 22, " FC Associate OB ", 19_000)); + employeesOfTheCompany.add(new Employee("Sam", 28, "Team Lead", 32_000)); + employeesOfTheCompany.add(new Intern("Taca", 31, " Ricever IB ", 22_000)); + employeesOfTheCompany.add(new Employee("Andy", 48, " Instructor IB", 25_000)); + employeesOfTheCompany.add(new Intern("Paul", 40, " Instructor OB ", 19_999)); + + for (Employee employee : employeesOfTheCompany) { + + if (employee instanceof Intern) { + + System.out.println("\nPresentation" + "\nName: " + employee.getNameEmployee() + "\nAge: " + employee.getAge() + "\nPosition in the Company: " + employee.getPositionEmployee() + "\nSalary: €" + employee.getSalaryOfEmployee()); + } + + else { + + System.out.println("\nPresentation" + "\nName: " + employee.getNameEmployee() + "\nAge: " + employee.getAge() + "\nPosition in the Company: " + employee.getPositionEmployee() + "\nSalary: €" + employee.getSalaryOfEmployee()); + } + + + + + } + + + } +} + + + +