Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Employee
- {
- protected String name;
- protected String id;
- protected String department;
- protected String type;
- public Employee () {
- this.name = "";
- this.id = "";
- this.department = "";
- this.type = " ";
- }
- public Employee(String name, String id, String department, String type) {
- this.name = name;
- this.id = id;
- this.department = department;
- this.type = type;
- }
- public Employee(Employee employee) {
- }
- public String getName() {
- return name;
- }
- public String getId() {
- return id;
- }
- public String getDepartment() {
- return department;
- }
- public String getType() {
- return type;
- }
- public void setName(String name) {
- this.name = name;
- }
- public void setId(String id) {
- this.id = id;
- }
- public void setDepartment(String department) {
- this.department = department;
- }
- public void setType(String type) {
- this.type = type;
- }
- public double calcWeeklySalary() {
- return 0;
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((department == null) ? 0 : department.hashCode());
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Employee other = (Employee) obj;
- if (department == null) {
- if (other.department != null)
- return false;
- } else if (!department.equals(other.department))
- return false;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- return true;
- }
- @Override
- public String toString() {
- return "Employee [name=" + name + ", id=" + id + ", department=" + department + ", type=" + type + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement