-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q_39.java
83 lines (76 loc) · 1.52 KB
/
Q_39.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
package Q39;
import java.util.Scanner;
class CommunityManager{
String name,address,dofJoin;
String contact;
Scanner sc=new Scanner(System.in);
void getName() {
System.out.println("Enter name:");
name=sc.nextLine();
}
void getAddress() {
System.out.println("Enter address:");
address=sc.nextLine();
}
void getDate_of_join() {
System.out.println("Enter date of joining:");
dofJoin=sc.nextLine();
}
void getContact() {
System.out.println("Enter contact:");
contact=sc.nextLine();
}
}
class Employee extends CommunityManager{
String qual;
void qualification() {
System.out.println("Enter qualification of an Employee:");
qual=sc.nextLine();
}
}
class Student extends CommunityManager{
String qual;
void qualification() {
System.out.println("Enter qualification of an Student:");
qual=sc.nextLine();
}
}
public class Q_39 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Employee obj1=new Employee();
Student obj2=new Student();
obj1.getName();
obj1.getAddress();
obj1.getDate_of_join();
obj1.getContact();
obj1.qualification();
obj2.getName();
obj2.getAddress();
obj2.getDate_of_join();
obj2.getContact();
obj2.qualification();
}
}
/*Output
Enter name:
Manisha Sahu
Enter address:
kanha kumari
Enter date of joining:
23-06-2010
Enter contact:
Enter qualification of an Employee:
Btech
Enter name:
Anumeha
Enter address:
Gulmohan kunj
Enter date of joining:
16-09-2011
Enter contact:
Enter qualification of an Student:
Mtech
*/