From 0e64490a3fc371eed8db0c8a53988dd30a9353a5 Mon Sep 17 00:00:00 2001 From: MityaTim Date: Sat, 4 Dec 2021 16:48:44 +0300 Subject: [PATCH] HW5 --- src/HW5/Employee.java | 55 +++++++++++++++++++++++++++++++++++++++++++ src/HW5/Main.java | 16 ++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/HW5/Employee.java diff --git a/src/HW5/Employee.java b/src/HW5/Employee.java new file mode 100644 index 0000000..aa097da --- /dev/null +++ b/src/HW5/Employee.java @@ -0,0 +1,55 @@ +package HW5; + +public class Employee { + private String name; + private String position; + private String mail; + private String phone; + private Integer salary; + private Integer age; + + public Employee(String name,String position,String mail,String phone,Integer salary,Integer age){ + this.name = name; + this.position = position; + this.mail = mail; + this.phone = phone; + this.salary = salary; + this.age = age; + }; + + public Integer getSalary() { + return salary; + } + + public String getMail() { + return mail; + } + + public String getName() { + return name; + } + + public String getPhone() { + return phone; + } + + public String getPosition() { + return position; + } + + public Integer getAge() { + return age; + } + + @Override + public String toString() { + return "Employee{" + + "name='" + name + '\'' + + ", position='" + position + '\'' + + ", mail='" + mail + '\'' + + ", phone='" + phone + '\'' + + ", salary=" + salary + + ", age=" + age + + '}'; + } +} diff --git a/src/HW5/Main.java b/src/HW5/Main.java index 2f236b6..d15b421 100644 --- a/src/HW5/Main.java +++ b/src/HW5/Main.java @@ -3,6 +3,20 @@ public class Main { public static void main(String[] args) { - // write your code here + System.out.println("Hello"); + + Employee [] employee = new Employee[5]; + employee[0] = new Employee("Ivan", "Dev.Team", "ivan@mail.dev.team.ru","8900123456",100000,30); + employee[1] = new Employee("Yuri", "Dev.Team", "yuri@mail.dev.team.ru","8900123457",100000,35); + employee[2] = new Employee("Stas", "Dev.Team", "stas@mail.dev.team.ru","8900123458",100000,40); + employee[3] = new Employee("Dima", "Dev.Team", "dima@mail.dev.team.ru","8900123459",100000,45); + employee[4] = new Employee("Vasia", "Dev.Team", "vasia@mail.dev.team.ru","8900123470",100000,50); + + for (int i = 0; i < employee.length; i++){ + if (employee[i].getAge() >= 40) { + System.out.println(employee[i].toString()); + } + } + } }