-
Notifications
You must be signed in to change notification settings - Fork 0
/
Faculty.java
173 lines (143 loc) · 4.12 KB
/
Faculty.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import java.io.*;
import java.util.*;
public class Faculty implements java.io.Serializable
{
private String fac_department;
private String fac_name;
private String fac_address;
private long fac_mobile_no;
private String fac_email_id;
//constructor
Faculty () {
fac_department = " ";
fac_name = " ";
fac_address = " ";
fac_mobile_no = 0;
fac_email_id = " ";
}
//setters
void set_fac_name (String n) {
fac_name = n;
}
void set_fac_dep (String d) {
fac_department = d;
}
void set_fac_address (String a) {
fac_address = a;
}
void set_fac_email_id (String e) {
fac_email_id = e;
}
void set_fac_mobile_no (long m) {
fac_mobile_no = m;
}
//getters
String get_fac_name () {
return fac_name;
}
String get_fac_dep () {
return fac_department;
}
String get_fac_address () {
return fac_address;
}
String get_fac_email_id () {
return fac_email_id;
}
long get_fac_mobile_no () {
return fac_mobile_no;
}
//functions
void display_fac_name(){
System.out.println("Name : " + fac_name);
}
void create_faculty()throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//try{
System.out.println("\n-- Faculty Creation Routine-- ");
System.out.println("Enter the details as mentioned.");
System.out.print("\n-- i. Faculty-name : ");
String fn = br.readLine();
fac_name= fn;
System.out.print("\n-- ii. Faculty's Address : ");
String ad = br.readLine();
fac_address= ad;
System.out.print("\n-- iii. Faculty's Department : ");
String dep = br.readLine();
fac_department= dep;
System.out.print("\n-- iv. Faculty's email-id : ");
String id = br.readLine();
fac_email_id= id;
System.out.print("\n-- v. Faculty's Contact Number: ");
long num=0;
try{
num = Long.parseLong(br.readLine());
}
catch(Exception e){
System.out.println("Incorrect format");
}
fac_mobile_no= num;
//}
// catch(Exception et){
//System.out.println("Enter the details in a valid format");
//}
}
void edit_faculty()throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Which field do you want to edit");
System.out.println("1 - Name");
System.out.println("2 - Address");
System.out.println("3 - Mobile Number");
System.out.println("4 - E-mail ID");
System.out.println("5 - Department");
int cco = 0;
String stt;
try{
cco = Integer.parseInt(br.readLine());
}
catch(Exception e){
System.out.println("Enter valid credentials");
}
switch(cco)
{
//try{
case 1: System.out.println("Enter the changed faculty name");
stt= br.readLine();
set_fac_name(stt);
System.out.println("Name changed to : "+ get_fac_name());
break;
case 2: System.out.println("Enter the changed address");
stt= br.readLine();
fac_address = stt;
System.out.println("Address changed to : "+ fac_address);
break;
case 3: System.out.println("Enter the changed mobile number");
long numberm = 0;
try{
numberm = Long.parseLong(br.readLine());
}
catch(Exception e){
System.out.println("Enter a valid integer type value");
}
fac_mobile_no = numberm;
System.out.println("Mobile Number changed to : "+ fac_mobile_no);
break;
case 4: System.out.println("Enter the changed email id.");
stt = "[email protected]";
stt = br.readLine();
fac_email_id = stt;
System.out.println("Email ID changed to : "+ fac_email_id);
break;
case 5: System.out.println("Enter the changed department name.");
stt = br.readLine();
fac_department = stt;
System.out.println("Department changed to : "+ fac_department);
break;
default : System.out.println("Invalid entry");
//catch(Exception et){
//System.out.println("Input format error");
//}
//}
}
}
}