-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
147 lines (145 loc) · 3.78 KB
/
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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
import java.time.OffsetDateTime;
import java.util.*;
class Employee1
{
String name;
int age;
long phoneNo;
Double Salary;
String Address;
void setName(String name)
{
this.name=name;
}
void setAge(int age)
{
this.age=age;
}
void setphoneNo(long phoneNo)
{
this.phoneNo=phoneNo;
}
void setSalary(Double Salary)
{
this.Salary=Salary;
}
void setAddress(String Address)
{
this.Address=Address;
}
String getName()
{
return name;
}
int getAge()
{
return age;
}
long getLongPhoneNo()
{
return phoneNo;
}
Double printSalary()
{
return Salary;
}
String getAddress()
{
return Address;
}
}
class officer extends Employee1
{
String spacialization;
String Department;
void setSpacialization(String spacialization)
{
this.spacialization=spacialization;
}
void setDepartment(String Department)
{
this.Department=Department;
}
String getSpacialization()
{
return spacialization;
}
String getDepartment()
{
return Department;
}
}
class Manager extends Employee1
{
String spacialization;
String Department;
void setSpacialization(String spacialization)
{
this.spacialization=spacialization;
}
void setDepartment(String Department)
{
this.Department=Department;
}
String getSpacialization()
{
return spacialization;
}
String getDepartment()
{
return Department;
}
}
class Employee
{
public static void main(String agrs[])
{
officer of=new officer();
Scanner sc=new Scanner(System.in);
System.out.println("Enter the officer's details");
System.out.println("Name");
of.setName(sc.nextLine());
System.out.println("Age");
of.setAge(sc.nextInt());
System.out.println("PhoneNumber");
of.setphoneNo(sc.nextLong());
System.out.println("Salary");
of.setSalary(sc.nextDouble());
System.out.println("Address");
of.setAddress(sc.nextLine());
System.out.println("Spacialization");
of.setSpacialization(sc.nextLine());
System.out.println("Department");
of.setDepartment(sc.nextLine());
System.out.println("Name is:"+of.getName());
System.out.println("Age is"+of.getAge());
System.out.println("phone number is:"+of.getLongPhoneNo());
System.out.println("Salary is "+of.printSalary());
System.out.println("Address is"+of.getAddress());
System.out.println("spacialization is:"+of.getSpacialization());
System.out.println("Department is :"+of.getDepartment());
System.out.println("Enter manager details");
Manager m=new Manager();
System.out.println("Name");
m.setName(sc.nextLine());
System.out.println("Age");
m.setAge(sc.nextInt());
System.out.println("PhoneNumber");
m.setphoneNo(sc.nextLong());
System.out.println("Salary");
m.setSalary(sc.nextDouble());
System.out.println("Address");
m.setAddress(sc.nextLine());
System.out.println("Spacialization");
m.setSpacialization(sc.nextLine());
System.out.println("Department");
m.setDepartment(sc.nextLine());
System.out.println("Name is:"+m.getName());
System.out.println("Age is"+m.getAge());
System.out.println("phone number is:"+m.getLongPhoneNo());
System.out.println("Salary is "+m.printSalary());
System.out.println("Address is"+m.getAddress());
System.out.println("spacialization is:"+m.getSpacialization());
System.out.println("Department is :"+m.getDepartment());
}
}