diff --git a/lesson2/src/main/java/ru/gb/savilin/lesson4/Employee.java b/lesson2/src/main/java/ru/gb/savilin/lesson4/Employee.java new file mode 100644 index 0000000..7f4e17c --- /dev/null +++ b/lesson2/src/main/java/ru/gb/savilin/lesson4/Employee.java @@ -0,0 +1,36 @@ +package ru.gb.savilin.lesson4; + +public class Employee { + + private String name; + private String position; + private String email; + private String phoneNumber; + private int salary; + private int age; + + Employee(String name, String position, String email, String phoneNumber, int salary, int age){ + this.name = name; + this.position = position; + this.email = email; + this.phoneNumber = phoneNumber; + this.salary = salary; + this.age = age; + } + + @Override + public String toString() { + return "Employee{" + + "name='" + name + '\'' + + ", position='" + position + '\'' + + ", email='" + email + '\'' + + ", phoneNumber='" + phoneNumber + '\'' + + ", salary=" + salary + + ", age=" + age + + '}'; + } + + public int getAge() { + return age; + } +} diff --git a/lesson2/src/main/java/ru/gb/savilin/lesson4/Main.java b/lesson2/src/main/java/ru/gb/savilin/lesson4/Main.java new file mode 100644 index 0000000..b43c5d1 --- /dev/null +++ b/lesson2/src/main/java/ru/gb/savilin/lesson4/Main.java @@ -0,0 +1,20 @@ +package ru.gb.savilin.lesson4; + +public class Main { + + public static void main(String[] args) { + Employee [] employees = new Employee[5]; + employees[0] = new Employee("Jhon Doe","developer", "jhondoe@hornsandhoofs.com","89000000000",1000,27); + employees[1] = new Employee("Dave Doe","developer", "davedoe@hornsandhoofs.com","89000000001",1100,37); + employees[2] = new Employee("Kevin Doe","manager", "paperrat@hornsandhoofs.com","89000000002",2000,41); + employees[3] = new Employee("Terry Doe","manager", "terrydoe@hornsandhoofs.com","89000000003",3000,42); + employees[4] = new Employee("Arnold Doe","ceo", "arnolddoe@hornsandhoofs.com","89000000004",10000,44); + + + for (int i = 0; i40){ + System.out.println(employees[i].toString()); + } + } + } +}