From a929bcf7e5b0730f2b55637115d8b4356a1247d1 Mon Sep 17 00:00:00 2001 From: Nuray Taghiyeva Date: Mon, 23 Feb 2026 17:31:19 +0400 Subject: [PATCH 1/3] lab finished --- .idea/.gitignore | 10 ++++++ .idea/compiler.xml | 13 ++++++++ .idea/encodings.xml | 7 ++++ .idea/jarRepositories.xml | 20 +++++++++++ .idea/lab-java-standard-input-and-classes.iml | 9 +++++ .idea/misc.xml | 14 ++++++++ .idea/modules.xml | 8 +++++ .idea/vcs.xml | 6 ++++ Lab2/pom.xml | 17 ++++++++++ .../java/org/ironhack/envsetup/Employee.java | 31 ++++++++++++++++++ .../java/org/ironhack/envsetup/Intern.java | 21 ++++++++++++ .../main/java/org/ironhack/envsetup/Main.java | 26 +++++++++++++++ .../org/ironhack/envsetup/Employee.class | Bin 0 -> 1803 bytes .../org/ironhack/envsetup/Intern.class | Bin 0 -> 947 bytes .../classes/org/ironhack/envsetup/Main.class | Bin 0 -> 1986 bytes employees.txt | 4 +++ 16 files changed, 186 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/lab-java-standard-input-and-classes.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 Lab2/pom.xml create mode 100644 Lab2/src/main/java/org/ironhack/envsetup/Employee.java create mode 100644 Lab2/src/main/java/org/ironhack/envsetup/Intern.java create mode 100644 Lab2/src/main/java/org/ironhack/envsetup/Main.java create mode 100644 Lab2/target/classes/org/ironhack/envsetup/Employee.class create mode 100644 Lab2/target/classes/org/ironhack/envsetup/Intern.class create mode 100644 Lab2/target/classes/org/ironhack/envsetup/Main.class create mode 100644 employees.txt diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..653c2cb --- /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..8abc343 --- /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/lab-java-standard-input-and-classes.iml b/.idea/lab-java-standard-input-and-classes.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/lab-java-standard-input-and-classes.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..d1e1729 --- /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..398d0f7 --- /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/Lab2/pom.xml b/Lab2/pom.xml new file mode 100644 index 0000000..f4447fe --- /dev/null +++ b/Lab2/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.ironhack.envsetup + Lab2 + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + \ No newline at end of file diff --git a/Lab2/src/main/java/org/ironhack/envsetup/Employee.java b/Lab2/src/main/java/org/ironhack/envsetup/Employee.java new file mode 100644 index 0000000..4c52e49 --- /dev/null +++ b/Lab2/src/main/java/org/ironhack/envsetup/Employee.java @@ -0,0 +1,31 @@ +package org.ironhack.envsetup; +public class Employee { + private String name; + private String email; + private int age; + private double salary; + + public Employee(String name, String email, int age, double salary) { + this.name = name; + this.email = email; + this.age = age; + this.salary = salary; + } + + public String getName() { return name; } + public void setName(String name) { this.name = name; } + + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + + public int getAge() { return age; } + public void setAge(int age) { this.age = age; } + + public double getSalary() { return salary; } + public void setSalary(double salary) { this.salary = salary; } + + @Override + public String toString() { + return name + ", " + email + ", " + age + ", " + salary; + } +} \ No newline at end of file diff --git a/Lab2/src/main/java/org/ironhack/envsetup/Intern.java b/Lab2/src/main/java/org/ironhack/envsetup/Intern.java new file mode 100644 index 0000000..0b3560e --- /dev/null +++ b/Lab2/src/main/java/org/ironhack/envsetup/Intern.java @@ -0,0 +1,21 @@ +package org.ironhack.envsetup; +public class Intern extends Employee { + public static final double SALARY_LIMIT = 20000; + + public Intern(String name, String email, int age, double salary) { + super(name,email,age,validateSalary(salary)); + } + + private static double validateSalary(double salary) { + if (salary > SALARY_LIMIT) { + System.out.println("Salary exceeds intern limit. Setting to " + SALARY_LIMIT); + return SALARY_LIMIT; + } + return salary; + } + + @Override + public void setSalary(double salary) { + super.setSalary(validateSalary(salary)); + } +} \ No newline at end of file diff --git a/Lab2/src/main/java/org/ironhack/envsetup/Main.java b/Lab2/src/main/java/org/ironhack/envsetup/Main.java new file mode 100644 index 0000000..1dbb183 --- /dev/null +++ b/Lab2/src/main/java/org/ironhack/envsetup/Main.java @@ -0,0 +1,26 @@ +package org.ironhack.envsetup; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; + +public class Main { + public static void main(String[] args) { + ArrayList employees = new ArrayList<>(); + + employees.add(new Employee("Alice", "alice@email.com", 30, 50000)); + employees.add(new Employee("Bob", "bob@email.com", 28, 48000)); + employees.add(new Intern("Charlie", "charlie@email.com", 22, 25000)); + employees.add(new Intern("Daisy", "daisy@email.com", 21, 18000)); + // Add more employees/interns until you reach 10 + + try (PrintWriter writer = new PrintWriter(new FileWriter("employees.txt"))) { + for (Employee emp : employees) { + writer.println(emp); + } + System.out.println("Employees written to employees.txt"); + } catch (IOException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/Lab2/target/classes/org/ironhack/envsetup/Employee.class b/Lab2/target/classes/org/ironhack/envsetup/Employee.class new file mode 100644 index 0000000000000000000000000000000000000000..c4e79dc06d2c8efda345897c58d1a96665555d19 GIT binary patch literal 1803 zcma)*+fLg+5QcvzAr7fSQVxMYp|pjP1WJ0KCju>JH4>#4LG+?mOIQViV@I|@;;xU; zhp5z6DyqaqAD|Cab;dRj5`&t=-rdRU%(wIJ{P}zK8^9t~l87LxBBr4WaRr$JaV$!P zFzclcy9cu7Du^%WrtZE`5X~2Mx{*M)ill~H&=ibWcDP z>=QDt^%8te!!Sk^3^v4}T(!)aa6jtqKFu6gn69H>KHr(P(^6S0bQ%>D{&({ZopROM zBi!_+Zpy8r#;&xt#jfF<+o}m;N7y>A17pnH*NJX?^XB4}6{vOTZg~al&xb;)RBzv5 zAOyESXbB3j&ef$UIS11?S(mxOq-ljK8!Th_3UBJBzpFv9$zzQy75adgQ(wQBUW1aq7w~^5w`~1HpHKAs%1Iu|&6u yA+mfY=tl literal 0 HcmV?d00001 diff --git a/Lab2/target/classes/org/ironhack/envsetup/Intern.class b/Lab2/target/classes/org/ironhack/envsetup/Intern.class new file mode 100644 index 0000000000000000000000000000000000000000..7aa9f73c89c5519ef5c1cc63c5a333f61a711959 GIT binary patch literal 947 zcmZva-A)rh7>3`WrQ4P*U?~U+xc&hJ>>}|DH4>^xlVXg;CLWogOv>o~G}|eWJMa!X z^A?C6sPVuH@YMS;zO!u%Ds8g!&9~n^@AvoP*SGHg9$>qOF=QNMU5q0quox#@Ung;N zEIV&}6`k~z8T9-{WK;llRoyj#5W`kFQyr7wAx%n%7dsFb~hf-u4!M zwXGuNvEbl}i>p`^m`Nr71`9YnD-*CsvlkRqZQC9#ySN5Vpunb{Z(v)%ZS6L9pTB(7 zZ0t7<1Vmk+v=>KxBO}w6!GK-M?!`wurkXlZPY2{aaySTqaTQ7(u%oie5Ygb|`lGp*T80aV<;g*n+wC|EqXf0@eh>NH#V2%vtJ>;!1B`LRmD0{*4m(Dqf6Mt9m-g%M(Hdm-13p&3*K$i+)4$d_a89z z2~*|S&$!I%*~%H;WMGxcjI;WACOb|23MSJGY~uVnB?EpMFDi6$#v_ScBCLF2eKoCT c>EC*0NUfx_xipu;pLz-@mtDse0b{uP8z}3*KL7v# literal 0 HcmV?d00001 diff --git a/Lab2/target/classes/org/ironhack/envsetup/Main.class b/Lab2/target/classes/org/ironhack/envsetup/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..1a24735e56527b39edc0b8f61427fc7fbf43d481 GIT binary patch literal 1986 zcmah~-%}e^6#gy*b_q)fAxWXqmR21}fuvTnN@&Z^Ry0602nOnpO}LV!o87p(0picM zJ~`uyGmbCzp)>N}i)e?4%&5=4`Q~4s{tNohdhTu(0;OXzlfC!sIp6)xch0%_?ZHn! z1Gs`ugJ?jbgn)u3G&6+O)O9tftHx?_F1N<>4ny;ZW@ye;hQ_}5f&`hN({(C4nw}i9 zEVYu>Y$pgw;IuNFF|F04W|>Ao&EHOPW8LOXxs;qLmUOeixr{c3rZHX1)3TkRT@}kw zUQ{(bkvEIYqkpdvH6TdePC+Ze5bsML5X(50W~`^9<5NLA7*^@_CA(BkyhM z;r{S5I*U#jams&E)$EFle#(DEEbG00|Dtwy(wAB@lQ$`6XVKE=Pzld6gk3%8#dS^R zo?XUslnJltY$u#es>($?FEo7Nhz>OkgWw1QXgDj}4F7`kyJC%?7}EttWqggFH_@!FxD&QxrN7wKfPOy@_v6nu3_6Rs9h zGBOP3{dTo`H%N4c8@-O%dqmqeK=ZIDNRhnWP#ne*q_YZ^#AG$)b<^e&ZuzcmcJl?x z+)#5m4`LZ_D|iR*QVpqZGv!jr;Th;hd`yhqoy_%whz3eEIepk0!ljGj#ws$kphYmI)zYtVftZXd;S zz-{QXYe5kPStyu&3z?vR-91RzDq7P0dkAL3O87+ROa!4S!aImAddBYX6QQ06P9GT0 zX2a*gPljR Date: Mon, 23 Feb 2026 17:39:40 +0400 Subject: [PATCH 2/3] labb --- Lab2/src/main/java/org/ironhack/envsetup/Main.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lab2/src/main/java/org/ironhack/envsetup/Main.java b/Lab2/src/main/java/org/ironhack/envsetup/Main.java index 1dbb183..fb0ed3e 100644 --- a/Lab2/src/main/java/org/ironhack/envsetup/Main.java +++ b/Lab2/src/main/java/org/ironhack/envsetup/Main.java @@ -12,6 +12,12 @@ public static void main(String[] args) { employees.add(new Employee("Bob", "bob@email.com", 28, 48000)); employees.add(new Intern("Charlie", "charlie@email.com", 22, 25000)); employees.add(new Intern("Daisy", "daisy@email.com", 21, 18000)); + employees.add(new Employee("Elena", "elena@email.com", 27, 47000)); + employees.add(new Employee("Frank", "frank@email.com", 35, 52000)); + employees.add(new Intern("George", "george@email.com", 23, 19000)); + employees.add(new Intern("Hannah", "hannah@email.com", 21, 22000)); // salary 20000 olacaq + employees.add(new Employee("Ian", "ian@email.com", 40, 60000)); + employees.add(new Employee("Jane", "jane@email.com", 29, 48000)); // Add more employees/interns until you reach 10 try (PrintWriter writer = new PrintWriter(new FileWriter("employees.txt"))) { From 610c372bbd09b09a481297028d1c6f5bba6d89a4 Mon Sep 17 00:00:00 2001 From: Nuray Taghiyeva Date: Mon, 23 Feb 2026 17:40:54 +0400 Subject: [PATCH 3/3] lab --- Lab2/src/main/java/org/ironhack/envsetup/Main.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lab2/src/main/java/org/ironhack/envsetup/Main.java b/Lab2/src/main/java/org/ironhack/envsetup/Main.java index fb0ed3e..5cc0032 100644 --- a/Lab2/src/main/java/org/ironhack/envsetup/Main.java +++ b/Lab2/src/main/java/org/ironhack/envsetup/Main.java @@ -15,10 +15,10 @@ public static void main(String[] args) { employees.add(new Employee("Elena", "elena@email.com", 27, 47000)); employees.add(new Employee("Frank", "frank@email.com", 35, 52000)); employees.add(new Intern("George", "george@email.com", 23, 19000)); - employees.add(new Intern("Hannah", "hannah@email.com", 21, 22000)); // salary 20000 olacaq + employees.add(new Intern("Hannah", "hannah@email.com", 21, 22000)); employees.add(new Employee("Ian", "ian@email.com", 40, 60000)); employees.add(new Employee("Jane", "jane@email.com", 29, 48000)); - // Add more employees/interns until you reach 10 + try (PrintWriter writer = new PrintWriter(new FileWriter("employees.txt"))) { for (Employee emp : employees) {