package javalearning;
import java.time.LocalDate;
public class EmployeeTest {
public static void main(String[] args) {
Employee[] staff = new Employee[3];
staff[0] = new Employee("lili", 700, 1993, 12, 15);
staff[1] = new Employee("max", 100, 1998, 12, 15);
staff[2] = new Employee("jiating", 750, 1987, 12, 15);
for (Employee e : staff)
e.raiseSalary(5);
for (Employee e : staff)
System.out.println("name=" + e.getName() + ",salary=" + e.getsalary() + ", hireDay=" + e.gethireDay());
}
}
class Employee {
private String name;
private double salary;
private LocalDate hireDay;
public Employee(String n, double s, int year, int month, int day) {
name = n;
salary = s;
hireDay = LocalDate.of(year, month, day);
}
public String getName() {
return name;
}
public double getsalary() {
return salary;
}
public LocalDate gethireDay() {
return hireDay;
}
public void raiseSalary(double byPercent) {
double raise = this.salary * byPercent / 100;
this.salary += raise;
}
}
class Manger extends Employee{
public Manger(String n, double s, int year, int month, int day) {
super(n, s,year, month, day);
}
}