-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment 2
More file actions
121 lines (121 loc) · 2.77 KB
/
Assignment 2
File metadata and controls
121 lines (121 loc) · 2.77 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
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
import java.util.*;
class Employee{
int id;
String name;
String address;
String mail_id;
long mob_no;
Scanner sc=new Scanner(System.in);
void getdata() {
System.out.println("Enter Employee name:");
name=sc.nextLine();
System.out.println("Enter Employee id:");
id=sc.nextInt();
System.out.println("Enter Employee Address:");
address=sc.next();
System.out.println("Enter Employee mobile no:");
mob_no=sc.nextLong();
System.out.println("Enter Employee mail id:");
mail_id=sc.next();
}
void display()
{
System.out.println("Employee name is:"+name);
System.out.println("Employee id is:"+id);
System.out.println("Employee address is:"+address);
System.out.println("Employee mobile no is:"+mob_no);
System.out.println("Employee mail_id is:"+mail_id);
}
}
class Programmer extends Employee {
double gross_sal;
double net_sal;
double BP;
double DA;
double HRA;
double PF;
double club_fee;
void programmer_sal(){
System.out.println("Enter Basic Pay of programmer:");
double BP= sc.nextDouble();
DA=(0.97*BP);
HRA=(0.10*BP);
PF=(0.12*BP);
club_fee=(0.01*BP);
gross_sal=(BP+HRA+DA);
net_sal=(gross_sal-(PF+club_fee));
System.out.println("The gross salary is:"+gross_sal);
System.out.println("The net salary is:"+net_sal);
}
}
class TeamLead extends Employee{
double gross_sal;
double net_sal;
double BP;
double DA;
double HRA;
double PF;
double club_fee;
void teamlead_sal(){
System.out.println("Enter Basic Pay of Team Lead:");
double BP= sc.nextDouble();
DA=(0.97*BP);
HRA=(0.10*BP);
PF=(0.12*BP);
club_fee=(0.01*BP);
gross_sal=(BP+HRA+DA);
net_sal=(gross_sal-(PF+club_fee));
System.out.println("The gross salary is:"+gross_sal);
System.out.println("The net salary is:"+net_sal);
}
}
class Project_manager extends Employee{
double gross_sal;
double net_sal;
double BP;
double DA;
double HRA;
double PF;
double club_fee;
void projectmanager_sal(){
System.out.println("Enter Basic Pay of Project manager:");
double BP= sc.nextDouble();
DA=(0.97*BP);
HRA=(0.10*BP);
PF=(0.12*BP);
club_fee=(0.01*BP);
gross_sal=(BP+HRA+DA);
net_sal=(gross_sal-(PF+club_fee));
System.out.println("The gross salary is:"+gross_sal);
System.out.println("The net salary is:"+net_sal);
}
}
class Salary1{
public static void main (String[]args){
int ch;
Scanner sc=new Scanner(System.in);
System.out.println("\n1.Programmer \n2.Team Lead \n3.Project Manager");
System.out.println("Enter your choice:");
ch=sc.nextInt();
switch(ch){
case 1:
Programmer obj1=new Programmer();
obj1.getdata();
obj1.display();
obj1.programmer_sal();
//break;
case 2:
TeamLead obj2=new TeamLead();
obj2.getdata();
obj2.display();
obj2.teamlead_sal();
//break;
case 3:
Project_manager obj3=new Project_manager();
obj3.getdata();
obj3.display();
obj3.projectmanager_sal();
break;
}
}
}