-
Notifications
You must be signed in to change notification settings - Fork 0
/
exp-1
118 lines (79 loc) · 2.14 KB
/
exp-1
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
import java.util.*;
class Employee
{
String name;
int age;
long phoneno;
String address;
long salary;
void print_salary(long salary)
{
this.salary=salary;
System.out.println("Salary:"+salary);
}
}
class Officer extends Employee
{
String specialization;
}
class Manager extends Employee
{
String department;
}
class main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
Officer ob1=new Officer();
System.out.println("Enter the details of officer");
System.out.print("Name:");
ob1.name=sc.nextLine();
System.out.print("Age:");
ob1.age=sc.nextInt();
System.out.print("Phone no:");
ob1.phoneno=sc.nextLong();
sc.nextLine();
System.out.print("Address:");
ob1.address=sc.nextLine();
System.out.print("Salary:");
ob1.salary=sc.nextLong();
sc.nextLine();
System.out.print("Specialization:");
ob1.specialization=sc.nextLine();
Manager ob2=new Manager();
System.out.println("Enter the details of Manager");
System.out.print("Name:");
ob2.name=sc.nextLine();
System.out.print("Age:");
ob2.age=sc.nextInt();
System.out.print("Phone no:");
ob2.phoneno=sc.nextLong();
sc.nextLine();
System.out.print("Address:");
ob2.address=sc.nextLine();
System.out.print("Salary:");
ob2.salary=sc.nextLong();
sc.nextLine();
System.out.print("Department:");
ob2.department=sc.nextLine();
System.out.println();
System.out.println();
System.out.println("The details of the officer is");
System.out.println("Name:"+ob1.name);
System.out.println("Age:"+ob1.age);
System.out.println("Phone no:"+ob1.phoneno);
System.out.println("Address:"+ob1.address);
System.out.println("Salary:"+ob1.salary);
System.out.println("Specialization:"+ob1.specialization);
System.out.println();
System.out.println();
System.out.println("The details of the manager is");
System.out.println("Name:"+ob2.name);
System.out.println("Age:"+ob2.age);
System.out.println("Phone no:"+ob2.phoneno);
System.out.println("Address:"+ob2.address);
System.out.println("Salary:"+ob2.salary);
System.out.println("Department:"+ob2.department);
}
}