-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParticipant.java
176 lines (144 loc) · 4.18 KB
/
Participant.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
173
174
175
176
import java.io.*;
import java.util.*;
public class Participant implements java.io.Serializable
{
private String part_name;
private String part_address;
private long part_mobile_no;
private String part_org;
private String part_email_id;
/**********************************/
//constructor
Participant() {
part_name = " ";
part_address = " ";
part_mobile_no = 0;
part_org = " ";
part_email_id = " ";
}
//setters
void set_part_name (String n) {
part_name = n;
}
void set_part_address (String a) {
part_address = a;
}
void set_part_mobile_no (long m) {
part_mobile_no = m;
}
void set_part_org (String o) {
part_org = o;
}
void set_part_email_id (String e) {
part_email_id = e;
}
//getters
String get_part_name () {
return part_name;
}
String get_part_org () {
return part_org;
}
String get_part_address () {
return part_address;
}
String get_part_email_id () {
return part_email_id;
}
long get_part_mobile_no () {
return part_mobile_no;
}
//functions
void display_part_name(){
System.out.println("Name : " + part_name);
}
void create_participant()throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("\n\n-- Participant Creation Routine-- ");
//try{
System.out.println("\nEnter the details as mentioned.");
System.out.print("\n-- i. Participant-name : ");
String pn = br.readLine();
part_name= pn;
System.out.print("\n-- ii. Participant's Address : ");
String ad = br.readLine();
part_address= ad;
System.out.print("\n-- iii. Participant's Organisation : ");
String or = br.readLine();
part_org= or;
System.out.print("\n-- iv. Participant's email-id : ");
String id = br.readLine();
part_email_id= id;
System.out.print("\n-- v. Participant's Contact Number: ");
long num = 00;
try{
num = Long.parseLong(br.readLine());
}
catch(Exception e){
System.out.println("Enter a valid integer");
}
part_mobile_no= num;
//}
// catch(Exception et){
//System.out.println("Invalid input format");
//}
}
void edit_participant()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 - Organisation");
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 participant name");
stt= br.readLine();
set_part_name(stt);
System.out.println("Name changed to : "+ get_part_name());
break;
case 2: System.out.println("Enter the changed address");
stt= br.readLine();
part_address = stt;
System.out.println("Address changed to : "+ part_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");
}
part_mobile_no = numberm;
System.out.println("Mobile Number changed to : "+ part_mobile_no);
break;
case 4: System.out.println("Enter the changed email id.");
stt = "[email protected]";
stt = br.readLine();
part_email_id = stt;
System.out.println("Email ID changed to : "+ part_email_id);
break;
case 5: System.out.println("Enter the changed organisation name.");
stt = br.readLine();
part_org = stt;
System.out.println("Organisation name changed to : "+ part_org);
break;
default : System.out.println("Invalid entry");
//}
//catch(Exception et){
//System.out.println("Invalid format");
//}
}
}
}