
Employee.java
package com.klvchen.team.domain;
public class Employee {
private int id;
private String name;
private int age;
private double salary;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
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;
}
public Employee() {
super();
}
public Employee(int id, String name, int age, double salary) {
super();
this.id = id;
this.name = name;
this.age = age;
this.salary = salary;
}
public String getDetails() {
return id + "\t" + name + "\t" + age + "\t" + salary + "\t";
}
@Override
public String toString() {
return getDetails();
}
}
Programmer.java
package com.klvchen.team.domain;
import com.klvchen.team.service.Status;
public class Programmer extends Employee {
private int memberId; //开发团队中的id
private Status status = Status.FREE;
private Equipment equipment;
public Programmer() {
super();
}
public Programmer(int id, String name, int age, double salary, Equipment equipment) {
super(id, name, age, salary);
this.equipment = equipment;
}
public int getMemberId() {
return memberId;
}
public void setMemberId(int memberId) {
this.memberId = memberId;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public Equipment getEquipment() {
return equipment;
}
public void setEquipment(Equipment equipment) {
this.equipment = equipment;
}
@Override
public String toString() {
return getDetails() + "\t程序员\t" + status + "\t\t\t" + equipment.getDescription();
}
public String getTeamBaseDetails() {
return memberId + "/" + getId() + "\t" + getName() + "\t" + getAge() + "\t" + getSalary();
}
public String getDetailsForTeam() {
return getTeamBaseDetails() + "\t程序员";
}
}
Designer.java
package com.klvchen.team.domain;
public class Designer extends Programmer {
private double bonus; //奖金
public Designer() {
super();
}
public Designer(int id, String name, int age, double salary, Equipment equipment, double bonus) {
super(id, name, age, salary, equipment);
this.bonus = bonus;
}
public double getBonus() {
return bonus;
}
public void setBonus(double bonus) {
this.bonus = bonus;
}
@Override
public String toString() {
return getDetails() + "\t设计师\t" + getStatus() + "\t" + bonus + "\t\t" + getEquipment().getDescription();
}
public String getDetailsForTeam() {
return getTeamBaseDetails() + "\t设计师\t" + getBonus();
}
}
Architect.java
package com.klvchen.team.domain;
public class Architect extends Designer{
private double stock; //股票
public Architect() {
super();
}
public Architect(int id, String name, int age, double salary, Equipment equipment, double bonus, double stock) {
super(id, name, age, salary, equipment, bonus);
this.stock = stock;
}
public double getStock() {
return stock;
}
public void setStock(double stock) {
this.stock = stock;
}
@Override
public String toString() {
return getDetails() + "\t架构师\t" + getStatus() + "\t" + getBonus() + "\t" + stock + "\t" + getEquipment().getDescription();
}
public String getDetailsForTeam() {
return getTeamBaseDetails() + "\t架构师\t" + getBonus() + "\t" + getStock();
}
}
Equipment.java
package com.klvchen.team.domain;
public interface Equipment {
String getDescription();
}
NoteBook.java
package com.klvchen.team.domain;
public class NoteBook implements Equipment {
private String model; //机器型号
private Double price; //价格
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public NoteBook() {
super();
}
public NoteBook(String model, Double price) {
super();
this.model = model;
this.price = price;
}
@Override
public String getDescription() {
return model + "(" + price + ")";
}
}
PC.java
package com.klvchen.team.domain;
public class PC implements Equipment {
private String model; //机器型号
private String display; //显示器名称
public PC() {
super();
}
public PC(String model, String display) {
super();
this.model = model;
this.display = display;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
@Override
public String getDescription() {
return model + "(" + display + ")";
}
}
Printer.java
package com.klvchen.team.domain;
public class Printer implements Equipment{
private String name; //机器型号
private String type; //机器类型
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Printer() {
super();
}
public Printer(String name, String type) {
super();
this.name = name;
this.type = type;
}
@Override
public String getDescription() {
return name + "(" + type + ")";
}
}