Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/lab-java-standard-input-and-classes.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Tasks/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.ironhack</groupId>
<artifactId>Tasks</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
52 changes: 52 additions & 0 deletions Tasks/src/main/java/com/ironhack/Employee.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.ironhack;

public class Employee {
protected String name;
protected String email;
protected int age;
protected 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 Employee(String name, String email, int age) {
this.name = name;
this.email = email;
this.age = age;
}

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;
}
}
21 changes: 21 additions & 0 deletions Tasks/src/main/java/com/ironhack/Intern.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.ironhack;

public class Intern extends Employee{
private static final double SALARY_LIMIT=20000;


public Intern(String name, String email, int age, double salary) {
super(name, email, age);
if(salary<SALARY_LIMIT){
setSalary(salary);
}
}

@Override
public void setSalary(double salary) {
if(salary<SALARY_LIMIT) {
super.setSalary(salary);
}
}
}

29 changes: 29 additions & 0 deletions Tasks/src/main/java/com/ironhack/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ironhack;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) throws IOException {
Employee[] employees = new Employee[10];
employees[0] = new Employee("John Doe", "john.doe@example.com", 30, 60000.0);
employees[1] = new Employee("Jane Smith", "jane.smith@example.com", 28, 55000.0);
employees[2] = new Employee("Peter Jones", "peter.jones@example.com", 35, 75000.0);
employees[3] = new Employee("Mary Williams", "mary.williams@example.com", 42, 80000.0);
employees[4] = new Employee("David Brown", "david.brown@example.com", 25, 50000.0);
employees[5] = new Employee("Laura Johnson", "laura.johnson@example.com", 31, 62000.0);
employees[6] = new Employee("Michael Davis", "michael.davis@example.com", 38, 70000.0);
employees[7] = new Employee("Sarah Miller", "sarah.miller@example.com", 29, 58000.0);
employees[8] = new Employee("James Wilson", "james.wilson@example.com", 45, 90000.0);
employees[9] = new Employee("Karen Moore", "karen.moore@example.com", 33, 65000.0);
try (
FileWriter writer = new FileWriter("result.txt", false)) {
for(Employee employee:employees){
writer.write("Name: "+employee.getName()+", email: "+employee.getEmail()+", age"+employee.getAge()+", salary: "+employee.getSalary()+"\n");
}
}
}
}
Binary file added Tasks/target/classes/com/ironhack/Employee.class
Binary file not shown.
Binary file added Tasks/target/classes/com/ironhack/Intern.class
Binary file not shown.
Binary file added Tasks/target/classes/com/ironhack/Main.class
Binary file not shown.
10 changes: 10 additions & 0 deletions result.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Name: John Doe, email: john.doe@example.com, age30, salary: 60000.0
Name: Jane Smith, email: jane.smith@example.com, age28, salary: 55000.0
Name: Peter Jones, email: peter.jones@example.com, age35, salary: 75000.0
Name: Mary Williams, email: mary.williams@example.com, age42, salary: 80000.0
Name: David Brown, email: david.brown@example.com, age25, salary: 50000.0
Name: Laura Johnson, email: laura.johnson@example.com, age31, salary: 62000.0
Name: Michael Davis, email: michael.davis@example.com, age38, salary: 70000.0
Name: Sarah Miller, email: sarah.miller@example.com, age29, salary: 58000.0
Name: James Wilson, email: james.wilson@example.com, age45, salary: 90000.0
Name: Karen Moore, email: karen.moore@example.com, age33, salary: 65000.0