Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. public class Employee
  2. {
  3.  
  4. protected String name;
  5. protected String id;
  6. protected String department;
  7. protected String type;
  8.  
  9. public Employee () {
  10. this.name = "";
  11. this.id = "";
  12. this.department = "";
  13. this.type = " ";
  14. }
  15.  
  16. public Employee(String name, String id, String department, String type) {
  17. this.name = name;
  18. this.id = id;
  19. this.department = department;
  20. this.type = type;
  21. }
  22.  
  23. public Employee(Employee employee) {
  24.  
  25. }
  26.  
  27. public String getName() {
  28. return name;
  29. }
  30.  
  31. public String getId() {
  32. return id;
  33. }
  34.  
  35. public String getDepartment() {
  36. return department;
  37. }
  38.  
  39. public String getType() {
  40. return type;
  41. }
  42.  
  43. public void setName(String name) {
  44. this.name = name;
  45. }
  46.  
  47. public void setId(String id) {
  48. this.id = id;
  49. }
  50.  
  51. public void setDepartment(String department) {
  52. this.department = department;
  53. }
  54.  
  55. public void setType(String type) {
  56. this.type = type;
  57. }
  58.  
  59. public double calcWeeklySalary() {
  60. return 0;
  61. }
  62.  
  63.  
  64.  
  65. @Override
  66. public int hashCode() {
  67. final int prime = 31;
  68. int result = 1;
  69. result = prime * result + ((department == null) ? 0 : department.hashCode());
  70. result = prime * result + ((id == null) ? 0 : id.hashCode());
  71. result = prime * result + ((name == null) ? 0 : name.hashCode());
  72. result = prime * result + ((type == null) ? 0 : type.hashCode());
  73. return result;
  74. }
  75.  
  76. @Override
  77. public boolean equals(Object obj) {
  78. if (this == obj)
  79. return true;
  80. if (obj == null)
  81. return false;
  82. if (getClass() != obj.getClass())
  83. return false;
  84. Employee other = (Employee) obj;
  85. if (department == null) {
  86. if (other.department != null)
  87. return false;
  88. } else if (!department.equals(other.department))
  89. return false;
  90. if (id == null) {
  91. if (other.id != null)
  92. return false;
  93. } else if (!id.equals(other.id))
  94. return false;
  95. if (name == null) {
  96. if (other.name != null)
  97. return false;
  98. } else if (!name.equals(other.name))
  99. return false;
  100. if (type == null) {
  101. if (other.type != null)
  102. return false;
  103. } else if (!type.equals(other.type))
  104. return false;
  105. return true;
  106. }
  107.  
  108. @Override
  109. public String toString() {
  110. return "Employee [name=" + name + ", id=" + id + ", department=" + department + ", type=" + type + "]";
  111. }
  112.  
  113.  
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement