package com.lovecoding.day12.ex02;

public class Employee implements Comparable {
    //编号、姓名、薪资、年龄，属性私有化，
    private Integer id;
    private String name;
    private Double salary;
    private Integer age;

    public Employee(Integer id, String name, Double salary, Integer age) {
        this.id = id;
        this.name = name;
        this.salary = salary;
        this.age = age;
    }

    public Employee() {
    }

    @Override
    public int compareTo(Object o) {
        //强制转换
        Employee emp = (Employee) o;
        //编号
        //return this.id - emp.id;
        return this.id.compareTo(emp.id);
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", salary=" + salary +
                ", age=" + age +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

}
