-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmployeeMain.java
88 lines (65 loc) · 1.35 KB
/
EmployeeMain.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
76
77
78
79
80
81
82
83
84
85
86
87
88
import java.util.Scanner;
class Personal
{
String Name;
int Pan;long acc_no;
double basic_pay;
Scanner sc=new Scanner(System.in);
Personal(String a,int b,long c,double d)
{
Name=a;
Pan=b;
acc_no=c;
basic_pay=d;
}
void display()
{
System.out.println("Enter employ name");
Name=sc.nextLine();
System.out.println("Enter employ Pan no");
Pan=sc.nextInt();
System.out.println("Enter employ basic salary");
basic_pay=sc.nextDouble();
System.out.println("Enter employ acc no");
acc_no=sc.nextLong();
}
}
class Retire extends Personal
{
double Yrs,Pf,Grat;
Retire(String a,int b,long c,double d,double e)
{
super(a,b,c,d);
Yrs=e;
}
void provident()
{
Pf=(2/100.0d*basic_pay)*Yrs;
System.out.println("Provident fund amount(Pf): Rs" +Pf);
}
void gratuity()
{
if(Yrs>=10)
{
Grat=12*basic_pay;
System.out.println("Gratuity amount: Rs" +Grat);
}
else
System.out.println("Gratuity amount is Nil");
}
void display1()
{
display();
System.out.println("Year of Service: "+Yrs);
provident();
gratuity();
}
}
class EmployeeMain
{
public static void main(String args[])
{
Retire reti1= new Retire("RishaV",1234567890,80476659L,50000.0d,8.0d);
reti1.display1();
}
}