diff --git a/Lab1.06/.gitignore b/Lab1.06/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/Lab1.06/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/Lab1.06/.idea/.gitignore b/Lab1.06/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Lab1.06/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Lab1.06/.idea/encodings.xml b/Lab1.06/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/Lab1.06/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Lab1.06/.idea/misc.xml b/Lab1.06/.idea/misc.xml new file mode 100644 index 0000000..df00c07 --- /dev/null +++ b/Lab1.06/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Lab1.06/.idea/vcs.xml b/Lab1.06/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Lab1.06/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lab1.06/output.txt b/Lab1.06/output.txt new file mode 100644 index 0000000..de2c4a8 --- /dev/null +++ b/Lab1.06/output.txt @@ -0,0 +1,40 @@ +Name : Jack Hawk +Email : jhawk@company.ent +Age : 48 +Wage 46001.3 +Name : Janice Hale +Email : jhale@company.ent +Age : 39 +Wage 25000.0 +Name : Nicky Kelly +Email : nkelly@company.entt +Age : 35 +Wage 35000.0 +Name : Chihiro Osaka +Email : cosaka@company.ent +Age : 38 +Wage 22000.3 +Name : Ulrich Schneider +Email : uschneider@company.ent +Age : 29 +Wage 20100.1 +Name : Naga Naga +Email : nnaga@company.entt +Age : 35 +Wage 34500.0 +Name : Yehu Joab +Email : yjoab@company.ent +Age : 21 +Wage 26500.7 +Name : Jackie Hawke +Email : jhawk@company.ent +Age : 48 +Wage 44000.1 +Name : Julius Maximus +Email : jmaximus@company.ent +Age : 30 +Wage 31000.9 +Name : Yuki Oh +Email : yoh@company.ent +Age : 23 +Wage 17000.0 diff --git a/Lab1.06/pom.xml b/Lab1.06/pom.xml new file mode 100644 index 0000000..14bb62d --- /dev/null +++ b/Lab1.06/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + Ironhack.schl + Lab1.06 + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + \ No newline at end of file diff --git a/Lab1.06/src/main/java/Ironhack/schl/Employee.java b/Lab1.06/src/main/java/Ironhack/schl/Employee.java new file mode 100644 index 0000000..59fac24 --- /dev/null +++ b/Lab1.06/src/main/java/Ironhack/schl/Employee.java @@ -0,0 +1,60 @@ +package Ironhack.schl; + +public class Employee { + + private String name; + private String email; + private int age; + private double salary; + + // Constructor + + public Employee(String name, String email, int age, double salary) { + this.name = name; + this.email = email; + this.age = age; + this.salary = salary; + } + //Getters + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + public int getAge() { + return age; + } + + public double getSalary() { + return salary; + } + + // Setters + + public void setName(String name) { + this.name = name; + } + + public void setEmail(String email) { + this.email = email; + } + + public void setAge(int age) { + this.age = age; + } + + public void setSalary(double salary) { + this.salary = salary; + } + + @Override + public String toString() { + return "Name : " + getName() + "\n" + "Email : " + + getEmail() + "\n" + "Age : " + getAge() + + "\n" + "Wage " + getSalary(); + } +} \ No newline at end of file diff --git a/Lab1.06/src/main/java/Ironhack/schl/Intern.java b/Lab1.06/src/main/java/Ironhack/schl/Intern.java new file mode 100644 index 0000000..cc58832 --- /dev/null +++ b/Lab1.06/src/main/java/Ironhack/schl/Intern.java @@ -0,0 +1,35 @@ +package Ironhack.schl; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +public class Intern extends Employee { + public final double SALARY_LIMIT = 20000.0; + private double internSalary; + private boolean isIntern; + + public Intern(String name, String email, int age, double salary, boolean isIntern) { + super(name, email, age, salary); + isIntern = true; + } + + public boolean isIntern() { + return this.isIntern; + } + + public void setIntern(boolean isIntern) { + this.isIntern = true; + } + + public void internMembership(double salary, double SALARY_LIMIT, boolean isIntern) { + if (salary <= SALARY_LIMIT) { + isIntern = true; + System.out.println(isIntern); + } else { + System.out.println("Employee"); + } + + } +} diff --git a/Lab1.06/src/main/java/Ironhack/schl/Main.java b/Lab1.06/src/main/java/Ironhack/schl/Main.java new file mode 100644 index 0000000..284f463 --- /dev/null +++ b/Lab1.06/src/main/java/Ironhack/schl/Main.java @@ -0,0 +1,35 @@ +package Ironhack.schl; + +import java.io.*; + +public class Main { + public static void main(String[] args) throws FileNotFoundException { + Employee employee1 = new Employee("Jack Hawk", "jhawk@company.ent",48,46001.3); + Employee employee2 = new Employee("Janice Hale", "jhale@company.ent",39,25000); + Employee employee3 = new Employee("Nicky Kelly", "nkelly@company.entt",35,35000); + Employee employee4 = new Employee("Chihiro Osaka", "cosaka@company.ent",38,22000.3); + Employee employee5 = new Employee("Ulrich Schneider", "uschneider@company.ent",29,20100.1); + Employee employee6 = new Employee("Naga Naga", "nnaga@company.entt",35,34500); + Employee employee7 = new Employee("Yehu Joab", "yjoab@company.ent",21,26500.7); + Employee employee8 = new Employee("Jackie Hawke", "jhawk@company.ent",48,44000.1); + Employee employee9 = new Employee("Julius Maximus", "jmaximus@company.ent",30,31000.9); + + PrintStream out = new PrintStream(new FileOutputStream("output.txt")); + System.setOut(out); + + System.out.println(employee1); + System.out.println(employee2); + System.out.println(employee3); + System.out.println(employee4); + System.out.println(employee5); + System.out.println(employee6); + System.out.println(employee7); + System.out.println(employee8); + System.out.println(employee9); + + Intern intern1 = new Intern("Yuki Oh", "yoh@company.ent",23,17000,false); + System.out.println(intern1); + } + + +} \ No newline at end of file