forked from abhishekdoifode1/Hacktoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assignment Bella.java
134 lines (129 loc) · 3.3 KB
/
Assignment Bella.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import java.util.Scanner;
class employee1
{
String name;
String mailid;
String address;
String mobileno;
int empid;
public
void getdata()
{
System.out.println("enter name,mailid,address,mobileno,empid");
Scanner input=new Scanner(System.in);
name=input.nextLine();
mailid=input.nextLine();
address=input.nextLine();
mobileno=input.nextLine();
empid=input.nextInt();
}
void display()
{
System.out.println("Payslip details are:");
System.out.println("name="+name);
System.out.println("mailid="+mailid);
System.out.println("address="+address);
System.out.println("empid="+empid);
System.out.println("mobileno="+mobileno);
}
}
class programmer extends employee1
{
double BP;
void calculate()
{
double DA,HRA,PF,SCF,GP,NP;
System.out.println("enter basic pay OF PROGRAMMER");
Scanner input=new Scanner(System.in);
BP=input.nextDouble();
DA=0.97*BP;
HRA=0.1*BP;
PF=0.12*BP;
SCF=0.001*BP;
GP=BP+DA+HRA;
NP=GP-PF-SCF;
display();
System.out.println("Gross pay="+GP);
System.out.println("Net salary="+NP);
}
}
class teamlead extends employee1
{
double BP;
void calculate()
{
double DA,HRA,PF,SCF,GP,NP;
System.out.println("enter basic pay of TEAMLEAD");
Scanner input1=new Scanner(System.in);
BP=input1.nextDouble();
DA=0.97*BP;
HRA=0.1*BP;
PF=0.12*BP;
SCF=0.001*BP;
GP=BP+DA+HRA;
NP=GP-PF-SCF;
display();
System.out.println("Gross pay="+GP);
System.out.println("grosspay="+GP);
}
}
class apm extends employee1
{
double BP;
void calculate()
{
double DA,HRA,PF,SCF,GP,NP;
System.out.println("enter basic pay of APM");
Scanner input1=new Scanner(System.in);
BP=input1.nextDouble();
DA=0.97*BP;
HRA=0.1*BP;
PF=0.12*BP;
SCF=0.001*BP;
GP=BP+DA+HRA;
NP=GP-PF-SCF;
display();
System.out.println("Gross pay="+GP);
System.out.println("grosspay="+GP);
}
}
class pm extends employee1
{
double BP;
void calculate()
{
double DA,HRA,PF,SCF,GP,NP;
System.out.println("enter basic pay of PM");
Scanner input1=new Scanner(System.in);
BP=input1.nextDouble();
DA=0.97*BP;
HRA=0.1*BP;
PF=0.12*BP;
SCF=0.001*BP;
GP=BP+DA+HRA;
NP=GP-PF-SCF;
display();
System.out.println("Gross pay="+GP);
System.out.println("grosspay="+GP);
}
}
class Main {
public static void main(String args[]) {
programmer obj=new programmer();
obj.getdata();
//obj.display();
obj.calculate();
teamlead obj1=new teamlead();
obj1.getdata();
//obj1.display();
obj1.calculate();
apm obj2=new apm();
obj2.getdata();
//obj2.display();
obj2.calculate();
pm obj3=new pm();
obj3.getdata();
//obj3.display();
obj3.calculate();
}
}