-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
57 lines (47 loc) · 1.15 KB
/
Employee.java
File metadata and controls
57 lines (47 loc) · 1.15 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
public class Employee {
// Properties
private String name;
private int age;
private String position;
private double salary;
// Constructor
public Employee(String name, int age, String position, double salary) {
this.name = name;
this.age = age;
this.position = position;
this.salary = salary;
}
// Getters
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getPosition() {
return position;
}
public double getSalary() {
return salary;
}
// Setters
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
public void setPosition(String position) {
this.position = position;
}
public void setSalary(double salary) {
this.salary = salary;
}
// Method to display employee info
public void printInfo() {
System.out.println("Name: " + name +
", Age: " + age +
", Position: " + position +
", Salary: " + salary);
}
}