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/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/.idea/lab-java-basics.iml b/.idea/lab-java-basics.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/lab-java-basics.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..772a231 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ 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/Tasks/Question1/Question1.java b/Tasks/Question1/Question1.java new file mode 100644 index 0000000..bd464e0 --- /dev/null +++ b/Tasks/Question1/Question1.java @@ -0,0 +1,49 @@ +package Question1; + +public class Question1 { + static void main(String[] args) { + + int[] values = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + for (int value : values) { + System.out.println(value); + + } + int difference = values[9] - values[0]; + System.out.println("The difference between the highest and lowest value is: " + difference); + + int highestValue = values[9]; + for (int value : values) { + if (value > highestValue) { + highestValue = value; + } + } + + + int lowestValue = values[0]; + for(int value : values) { + if (value < lowestValue) { + lowestValue = value; + } + } + int firstSmallest = values[0]; + for (int value : values) { + if (value < firstSmallest) { + firstSmallest = value; + } + } + int secondSmallest = values[1]; + for (int value : values) { + if (value < secondSmallest && value > firstSmallest) { + secondSmallest = value; + } + + + } + System.out.println(highestValue + " is the highest value"); + System.out.println(lowestValue + " is the lowest value"); + System.out.println(firstSmallest + " is the first smallest value"); + System.out.println(secondSmallest + " is the second smallest value"); + + + } +} \ No newline at end of file diff --git a/Tasks/Question3/ArrayOfEmployee.java b/Tasks/Question3/ArrayOfEmployee.java new file mode 100644 index 0000000..e44e0af --- /dev/null +++ b/Tasks/Question3/ArrayOfEmployee.java @@ -0,0 +1,23 @@ +package Question3; + +public class ArrayOfEmployee { + static void main(String[] args) { + EmployeeAndSalary emp1 = new EmployeeAndSalary(); + InternEmployee intern1 = new InternEmployee(); + + String[] employeeNames = {"Alice", "Bob", "Charlie", "Diana", "Ethan"," Fiona", "George", "Hannah","Lucia"}; + String[] employeePositions = {emp1.AS, emp1.RME, emp1.SDE, emp1.OPS, emp1.HR, emp1.AS, emp1.RME, emp1.SDE, emp1.OPS}; + int[] employeeSalaries = {emp1.AS_SALARY, emp1.RME_SALARY, emp1.SDE_SALARY, emp1.OPS_SALARY, emp1.HR_SALARY, emp1.AS_SALARY, emp1.RME_SALARY, emp1.SDE_SALARY, emp1.OPS_SALARY}; + + System.out.println("Employee Details:"); + for (int i = 0; i < employeeNames.length; i++) { + System.out.println("Name: " + employeeNames[i]); + System.out.println("Position: " + employeePositions[i]); + System.out.println("Salary: $" + employeeSalaries[i]); + System.out.println(); + } + + System.out.println("Interns Details:"); + intern1.displayInternDetails(); + } +} diff --git a/Tasks/Question3/EmployeeAndSalary.java b/Tasks/Question3/EmployeeAndSalary.java new file mode 100644 index 0000000..99aec79 --- /dev/null +++ b/Tasks/Question3/EmployeeAndSalary.java @@ -0,0 +1,16 @@ +package Question3; + +public class EmployeeAndSalary { + String AS = "Associate of amazon"; + String RME = "Mechanical Engineer"; + String SDE = "Sécurity Development Engineer"; + String OPS = "Supervisor of production and supply chain"; + String HR = "Human Resource Manager"; + + int AS_SALARY = 1500; + int RME_SALARY = 2500; + int SDE_SALARY = 2700; + int OPS_SALARY = 3000; + int HR_SALARY = 4500; + +} diff --git a/Tasks/Question3/InternEmployee.java b/Tasks/Question3/InternEmployee.java new file mode 100644 index 0000000..85b9467 --- /dev/null +++ b/Tasks/Question3/InternEmployee.java @@ -0,0 +1,15 @@ +package Question3; + +public class InternEmployee extends EmployeeAndSalary { + String intern = "Interns"; + String[] employeeIntern = {"Patrick", "Mohammad"}; + int INTERN_SALARY = 800; + int MAX_SALARY = 20000; + + public void displayInternDetails() { + System.out.println("Name: " + employeeIntern[0]+", " + employeeIntern[1]); + System.out.println("Position: " + intern); + System.out.println("Salary: $" + INTERN_SALARY); + System.out.println("Interns salary not exceed the salary limit : " + (INTERN_SALARY != MAX_SALARY && INTERN_SALARY < MAX_SALARY)); + } +}