-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMember.java
More file actions
70 lines (66 loc) · 2.46 KB
/
Member.java
File metadata and controls
70 lines (66 loc) · 2.46 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
public class Member {
String name;
int age;
int ph_no;
String address;
double salary;
public void printSalary() {
Employee obj1 = new Employee("Snigdha Singh", 19, 987654321, "ABC Lane, XYZ City",50000.00, "Java" );
Manager obj2 = new Manager("Akarsh Singh", 25, 90000000, "PQR Lane, STU City", 90000.00, "Software Development");
System.out.println("Employee Details :::");
System.out.println("name :: "+obj1.name);
System.out.print("age :: ");
System.out.println(obj1.age);
System.out.print("Phone No. :: ");
System.out.println(obj1.ph_no);
System.out.println("Address :: "+obj1.address);
System.out.print("Salary :: ");
System.out.println(obj1.salary);
System.out.println("Specialization :: "+obj1.specialization);
System.out.println("....................................................................");
System.out.println("Manager Details :::");
System.out.println("name :: "+obj2.name);
System.out.print("age :: ");
System.out.println(obj2.age);
System.out.print("Phone No. :: ");
System.out.println(obj2.ph_no);
System.out.println("Address :: "+obj2.address);
System.out.print("Salary :: ");
System.out.println(obj2.salary);
System.out.println("Department :: "+obj2.department);
}
Member(String name, int age, int ph_no, String address, double salary){
super();
}
Member(){
super();
}
public static void main(String[] args) {
Member obj = new Member();
obj.printSalary();
}
}
class Employee extends Member{
String specialization;
Employee(String name, int age, int ph_no, String address, double salary, String specialization) {
super(name, age, ph_no, address, salary);
this.name = name;
this.age = age;
this.ph_no = ph_no;
this.address = address;
this.salary = salary;
this.specialization = specialization;
}
}
class Manager extends Member{
String department;
Manager(String name, int age, int ph_no, String address, double salary, String department) {
super(name, age, ph_no, address, salary);
this.department = department;
this.name = name;
this.age = age;
this.ph_no = ph_no;
this.address = address;
this.salary = salary;
}
}