You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
827 B
26 lines
827 B
package w3;
|
|
|
|
public class EmployeeTest {
|
|
public static void main(String[] args) {
|
|
// 创建两个员工对象(通用信息)
|
|
Employee emp1 = new Employee("1001", "员工A", "开发部", 5000);
|
|
Employee emp2 = new Employee("1002", "员工B", "测试部", 2800);
|
|
|
|
// 打印初始信息
|
|
System.out.println("===== 第一个员工信息 =====");
|
|
emp1.printInfo();
|
|
|
|
System.out.println("===== 第二个员工信息 =====");
|
|
emp2.printInfo();
|
|
|
|
// 涨薪操作
|
|
emp1.raiseSalary(10);
|
|
System.out.println("===== 涨薪10%后员工1信息 =====");
|
|
emp1.printInfo();
|
|
|
|
// 修改部门
|
|
emp2.setDepartment("产品部");
|
|
System.out.println("===== 修改部门后员工2信息 =====");
|
|
emp2.printInfo();
|
|
}
|
|
}
|