5、完成下列需求 1)创建部门枚举,对象有:JAVA、HTML、PYTHON 2)创建员工实体类,属性有:姓名、年龄、薪资、部门枚举
时间: 2023-10-20 19:26:48 浏览: 102
以下是Java代码实现:
```java
// 部门枚举
public enum Department {
JAVA, HTML, PYTHON;
}
// 员工实体类
public class Employee {
private String name;
private int age;
private double salary;
private Department department;
public Employee(String name, int age, double salary, Department department) {
this.name = name;
this.age = age;
this.salary = salary;
this.department = department;
}
// getter 和 setter 方法省略
}
```
阅读全文