-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
29 lines (23 loc) · 762 Bytes
/
Employee.java
File metadata and controls
29 lines (23 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.model;
import java.io.Serializable;
public class Employee implements Serializable {
private int id;
private String name;
private double salary;
private String department;
public Employee(int id, String name, double salary, String department) {
this.id = id;
this.name = name;
this.salary = salary;
this.department = department;
}
public double calculateNetSalary() {
double tax = salary * 0.10;
return salary - tax;
}
@Override
public String toString() {
return "ID: " + id + ", Name: " + name + ", Department: " + department +
", Salary: $" + salary + ", Net Salary: $" + calculateNetSalary();
}
}