-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmp.java
More file actions
36 lines (27 loc) · 735 Bytes
/
Emp.java
File metadata and controls
36 lines (27 loc) · 735 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
30
31
32
33
34
35
36
package Employee;
public class Emp {
String name;
int id;
double basic, hra, da, net;
// Constructor
public Emp(String n, int i, double b) {
name = n;
id = i;
basic = b;
}
// Calculate Salary
public void calculate() {
hra = basic * 0.20;
da = basic * 0.10;
net = basic + hra + da;
}
// Display
public void display() {
System.out.println("Name : " + name);
System.out.println("ID : " + id);
System.out.println("Salary : " + basic);
System.out.println("HRA : " + hra);
System.out.println("DA : " + da);
System.out.println("Net Salary : " + net);
}
}