-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSheetal_employee.java
75 lines (71 loc) · 2.17 KB
/
Sheetal_employee.java
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import java.util.Scanner;
public class Sheetal_employee {
String name;
String number;
String design;
public void input(String name, String number, String design){
this.name=name;
this.number=number;
this.design=design;
}
public void display(){
System.out.println("Employee Name : "+name);
System.out.println("Employee Number :"+number);
System.out.println("Designation : "+design);
}
}
public class Permanent_Employee extends Sheetal_employee{
int basic_pay,HRA,DA,PF;
public void input(){
Scanner sc=new Scanner(System.in);
System.out.println("Enter basic_pay :");
basic_pay=sc.nextInt();
System.out.println("Enter HRA :");
HRA=sc.nextInt();
System.out.println("Enter DA :");
DA=sc.nextInt();
System.out.println("Enter PF :");
PF=sc.nextInt();
}
public void display(){
System.out.println("Basic_pay : "+basic_pay);
System.out.println("HRA : "+HRA);
System.out.println("DA : "+DA);
System.out.println("PF : "+PF);
}
public int calculate(){
return basic_pay+HRA+DA-PF;
}
}
public class Temporary_Employee extends Sheetal_employee{
int salary;
public void input(int sala){
Scanner sc=new Scanner(System.in);
System.out.println("Enter salary :");
salary=sala;
}
public void display(){
System.out.println("Salary : "+salary);
}
}
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter employee name : ");
String name=sc.nextLine();
System.out.println("Enter employee number : ");
String number=sc.next();
System.out.println("Enter employee designation : ");
String design=sc.next();
Sheetal_employee se=new Sheetal_employee();
se.input(name,number,design);
Permanent_Employee pe=new Permanent_Employee();
pe.input();
Temporary_Employee te=new Temporary_Employee();
int sal=pe.calculate();
te.input(sal);
se.display();
pe.display();
te.display();
}
}