-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student.java
634 lines (596 loc) · 19.8 KB
/
Student.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
public class Student extends JFrame implements ActionListener{
private JLabel label,label1,label2,l1,l2,l3,l4,l5;
private JTextField field1,f11,f12,f13,f14,f15,f16,f17,f18,f19,r;
private JPasswordField field2;
private JButton button1,button2,b1,b2,b3,bb8,bb9,b10,b11,b66,b7,bn1,bn2;
private IP_Address ip;
private EditExam ei;
public Question q;
private AddQ aq[];
private AddExamInfo ae;
private StudentOption op;
private TimerThread tt;
private ObjectOutputStream os,osm;
private ObjectInputStream is,ism;
private Socket client;
private String s,address,ans[];
private MarksTable mt;
private Marks m;
private TimerThread tht;
public Container container = getContentPane();
int l=0,k=0,mark=0,sum=0,mr;
// private Wait ww;
public Student()
{
super("Student");
container.setLayout(new BoxLayout(container,BoxLayout.Y_AXIS));
label1 = new JLabel("Username :",SwingConstants.LEFT);
label1.setToolTipText("Enter Username");
label2 = new JLabel("Password :",SwingConstants.LEFT);
label2.setToolTipText("Enter Password");
field1 = new JTextField();
field2 = new JPasswordField();
button1 = new JButton("OK");
button2 = new JButton("Cancel");
button1.addActionListener(this);
button2.addActionListener(this);
Box bx1 = Box.createHorizontalBox();
Box bx2 = Box.createHorizontalBox();
Box bx3 = Box.createHorizontalBox();
bx1.add(Box.createHorizontalStrut(50));
bx1.add(label1);
bx1.add(Box.createHorizontalStrut(50));
bx1.add(field1);
bx1.add(Box.createHorizontalStrut(50));
bx2.add(Box.createHorizontalStrut(50));
bx2.add(label2);
bx2.add(Box.createHorizontalStrut(50));
bx2.add(field2);
bx2.add(Box.createHorizontalStrut(50));
bx3.add(Box.createHorizontalStrut(50));
bx3.add(button1);
bx3.add(Box.createHorizontalStrut(50));
bx3.add(button2);
bx3.add(Box.createHorizontalStrut(50));
container.add(Box.createVerticalStrut(50));
container.add(bx1);
container.add(Box.createVerticalStrut(50));
container.add(bx2);
container.add(Box.createVerticalStrut(50));
container.add(bx3);
container.add(Box.createVerticalStrut(50));
setSize(350,300);
setLocation(230,130);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == button1){ // Taking user ID & password
if(!field1.getText().equals(field2.getText())){
JOptionPane.showMessageDialog(null,"Invalid username & password!!!\nTry again ...","Error",JOptionPane.ERROR_MESSAGE);
return;
}
setVisible(false);
bn1 = new JButton("OK");
bn2 = new JButton("Cancel");
ip = new IP_Address(bn1,bn2);
bn1.addActionListener(this);
bn2.addActionListener(this);
ip.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
if(e.getSource() == bn2){ // Exit
System.exit(0);
}
if(e.getSource() == bn1){ // Connecting to the server
ip.setVisible(false);
try{
client = new Socket(ip.field.getText(),12345);
System.out.println("student is connected to server...");
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Error in connecting to the server.\nPlease try again.","Error",JOptionPane.ERROR_MESSAGE);
return;
}
try{
os = new ObjectOutputStream(client.getOutputStream());
os.flush();
is = new ObjectInputStream(client.getInputStream());
}
catch(IOException ioe){
JOptionPane.showMessageDialog(null,"Unable to Connect.\nPlease enter correct IP Address.","Alert",JOptionPane.WARNING_MESSAGE);
return;
}
b1=new JButton("Appear at the exam");
b2=new JButton("View marks");
b3=new JButton("Cancel");
op = new StudentOption(b1,b2,b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
if(e.getSource()==b2){ // taking file name for view marks
op.setVisible(false);
f11 = new JTextField();
f12 = new JTextField();
f13 = new JTextField();
b66 =new JButton("OK");
b7 =new JButton("Cancel");
ei = new EditExam(f11,f12,f13,b66,b7);
b66.addActionListener(this);
b7.addActionListener(this);
}
if(e.getSource()==b66){ // Marks is shown here
try{
String s = new String("input");
String s1 = new String("marks_"+f11.getText().toUpperCase()+"_"+f12.getText().toUpperCase()+"_"+f13.getText().toUpperCase()+".txt");
String s2 = new String("marks");
os.writeObject(s);
os.flush();
os.writeObject(s1);
os.flush();
os.writeObject(s2);
os.flush();
mt = (MarksTable)is.readObject();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Marks file is not found.","Error",JOptionPane.ERROR_MESSAGE);
return;
}
String str = new String(field1.getText().substring(4));
int temp = Integer.parseInt(str);
Stdmark st = mt.arr[temp-1];
mr = st.marks;
if(mr == -1)
JOptionPane.showMessageDialog(null,"The exam may not be held yet\nor,you are not eligible for the exam.","Warning",JOptionPane.WARNING_MESSAGE);
else
JOptionPane.showMessageDialog(null,"You have got "+Integer.toString(mr),field1.getText(),JOptionPane.INFORMATION_MESSAGE);
}
if(e.getSource()==b3){ // Disconnecting from the server
try{
os.writeObject("disconnect");
os.flush();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Error in disconnecting from the server.","Error",JOptionPane.ERROR_MESSAGE);
}
op.setVisible(false);
System.exit(0);
}
if(e.getSource()==button2){
System.exit(0);
}
if(e.getSource()==b7){ // Student's GUI
ei.setVisible(false);
b1=new JButton("Appear at the exam");
b2=new JButton("View marks");
b3=new JButton("Cancel");
op = new StudentOption(b1,b2,b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
if(e.getSource()==b1){ // taking file name for appaering at the exam
op.setVisible(false);
f11 = new JTextField();
f12 = new JTextField();
f13 = new JTextField();
bb8 = new JButton("OK");
bb9 = new JButton("Cancel");
ei = new EditExam(f11,f12,f13,bb8,bb9);
bb8.addActionListener(this);
bb9.addActionListener(this);
}
if(e.getSource()==bb9){
ei.setVisible(false);
b1=new JButton("Appear at the exam");
b2=new JButton("View marks");
b3=new JButton("Cancel");
op = new StudentOption(b1,b2,b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
if(e.getSource()==bb8){
JOptionPane.showMessageDialog(null,"Please wait a few second ...","Information",JOptionPane.INFORMATION_MESSAGE);
try{
String sss = new String("input");
String ss1 = new String("marks_"+f11.getText().toUpperCase()+"_"+f12.getText().toUpperCase()+"_"+f13.getText().toUpperCase()+".txt");
String ss2 = new String("marks");
os.writeObject(sss);
os.flush();
os.writeObject(ss1);
os.flush();
os.writeObject(ss2);
os.flush();
mt = (MarksTable)is.readObject();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Marks file is not found.","Error",JOptionPane.ERROR_MESSAGE);
}
String str = new String(field1.getText().substring(4));
int temp = Integer.parseInt(str);
Stdmark st = mt.arr[temp-1];
mr = st.marks;
if(mr != -1){
JOptionPane.showMessageDialog(null,"You have already attended in the exam.","Warning",JOptionPane.WARNING_MESSAGE);
ei.setVisible(false);
b1=new JButton("Appear at the exam");
b2=new JButton("View marks");
b3=new JButton("Cancel");
op = new StudentOption(b1,b2,b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
else{
try{
String s = new String("input");
String s1 = new String(f11.getText().toUpperCase()+"_"+f12.getText().toUpperCase()+"_"+f13.getText().toUpperCase()+".txt");
String s2 = new String("Q_request");
os.writeObject(s);
os.flush();
os.writeObject(s1);
os.flush();
os.writeObject(s2);
os.flush();
ae = (AddExamInfo)is.readObject();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Question file is not found.","Error",JOptionPane.ERROR_MESSAGE);
return;
}
sum = ae.marks;
l = ae.totalques;
aq= new AddQ[l];
ans = new String[l];
for(int g=0; g<l; g++){
ans[g] = new String();
}
try{
for(int i=0; i<l; i++){
aq[i] = (AddQ)is.readObject();
}
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Error reading in the questions","Error",JOptionPane.ERROR_MESSAGE);
return;
}
ei.setVisible(false);
label = new JLabel("Time:"+Integer.toString(ae.time)+" min",SwingConstants.LEFT);
tht = new TimerThread(ae.time,label);
String mm = (String)ae.examtype;
if(mm.equals("MCQ")){
String s = Integer.toString(k+1);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
l2 = new JLabel("a : "+aq[k].A,SwingConstants.LEFT);
l3 = new JLabel("b : "+aq[k].B,SwingConstants.LEFT);
l4 = new JLabel("c : "+aq[k].C,SwingConstants.LEFT);
l5 = new JLabel("d : "+aq[k].D,SwingConstants.LEFT);
f19 = new JTextField();
b10 =new JButton("Next");
b11 =new JButton("Back");
q = new Question(label,s,l1,l2,l3,l4,l5,f19,b10,b11);
b10.addActionListener(this);
b11.setEnabled(false);
}
if(mm.equals("True/False")){
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
r = new JTextField();
String s = Integer.toString(k+1);
b10 =new JButton("Next");
b11 =new JButton("Back");
q = new Question(label,s,l1,r,b10,b11);
b10.addActionListener(this);
b11.setEnabled(false);
}
k++;
}
}
if(e.getSource()==b10 && mr==-1 && k<l-1){
String mm = (String)ae.examtype;
if(mm.equals("MCQ")){
if(!(f19.getText().equalsIgnoreCase("a") || f19.getText().equalsIgnoreCase("b") || f19.getText().equalsIgnoreCase("c") || f19.getText().equalsIgnoreCase("d"))){
JOptionPane.showMessageDialog(null,"Please enter a or b or c or d","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
ans[k-1]=f19.getText();
q.setVisible(false);
String s = Integer.toString(k+1);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
l2 = new JLabel("a : "+aq[k].A,SwingConstants.LEFT);
l3 = new JLabel("b : "+aq[k].B,SwingConstants.LEFT);
l4 = new JLabel("c : "+aq[k].C,SwingConstants.LEFT);
l5 = new JLabel("d : "+aq[k].D,SwingConstants.LEFT);
f19 = new JTextField(ans[k]);
b10 =new JButton("Next");
b11 =new JButton("Back");
q = new Question(label,s,l1,l2,l3,l4,l5,f19,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
if(mm.equals("True/False")){
if(!(r.getText().equalsIgnoreCase("T") || r.getText().equalsIgnoreCase("F"))){
JOptionPane.showMessageDialog(null,"Please enter T for true and F for false","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
ans[k-1] = r.getText();
q.setVisible(false);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
r = new JTextField(ans[k]);
String s = Integer.toString(k+1);
b10 =new JButton("Next");
b11 =new JButton("Back");
q = new Question(label,s,l1,r,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
k++;
}
if(e.getSource()==b10 && mr==-1 && k==l-1){
String mm = (String)ae.examtype;
if(mm.equals("MCQ")){
if(!(f19.getText().equalsIgnoreCase("a") || f19.getText().equalsIgnoreCase("b") || f19.getText().equalsIgnoreCase("c") || f19.getText().equalsIgnoreCase("d"))){
JOptionPane.showMessageDialog(null,"Please enter a or b or c or d","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
ans[k-1]=f19.getText();
q.setVisible(false);
String s = Integer.toString(k+1);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
l2 = new JLabel("a : "+aq[k].A,SwingConstants.LEFT);
l3 = new JLabel("b : "+aq[k].B,SwingConstants.LEFT);
l4 = new JLabel("c : "+aq[k].C,SwingConstants.LEFT);
l5 = new JLabel("d : "+aq[k].D,SwingConstants.LEFT);
f19 = new JTextField(ans[k]);
b10 =new JButton("Finish");
b11 =new JButton("Back");
q = new Question(label,s,l1,l2,l3,l4,l5,f19,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
if(mm.equals("True/False")){
if(!(r.getText().equalsIgnoreCase("T") || r.getText().equalsIgnoreCase("F"))){
JOptionPane.showMessageDialog(null,"Please enter T for true and F for false","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
ans[k-1] = r.getText();
q.setVisible(false);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
r = new JTextField(ans[k]);
String s = Integer.toString(k+1);
b10 =new JButton("Finish");
b11 =new JButton("Back");
q = new Question(label,s,l1,r,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
k++;
}
if(e.getSource()==b10 && mr==-1 && k>l-1){
String mm = (String)ae.examtype;
if(mm.equals("MCQ")){
if(!(f19.getText().equalsIgnoreCase("a") || f19.getText().equalsIgnoreCase("b") || f19.getText().equalsIgnoreCase("c") || f19.getText().equalsIgnoreCase("d"))){
JOptionPane.showMessageDialog(null,"Please enter a or b or c or d","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
ans[k-1]=f19.getText();
q.setVisible(false);
for(int i=0; i<l; i++){
if(ans[i].equalsIgnoreCase(aq[i].ans)){
mark += sum;
}
}
}
if(mm.equals("True/False")){
if(!(r.getText().equalsIgnoreCase("T") || r.getText().equalsIgnoreCase("F"))){
JOptionPane.showMessageDialog(null,"Please enter T for true and F for false","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
ans[k-1] = r.getText();
q.setVisible(false);
for(int i=0; i<l; i++){
if(ans[i].equalsIgnoreCase(aq[i].cans)){
mark += sum;
}
}
}
tht.stop();
mt.EditMark(field1.getText(),mark);
try{
String s = new String("output");
String s1 = new String("marks_"+f11.getText().toUpperCase()+"_"+f12.getText().toUpperCase()+"_"+f13.getText().toUpperCase()+".txt");
String s2 = new String("marks");
os.writeObject(s);
os.flush();
os.writeObject(s1);
os.flush();
os.writeObject(s2);
os.flush();
os.writeObject(mt);
os.flush();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Marks file is not updated","Error",JOptionPane.ERROR_MESSAGE);
return;
}
b1=new JButton("Appear at the exam");
b2=new JButton("View marks");
b3=new JButton("Cancel");
op = new StudentOption(b1,b2,b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
k=0;
}
if(e.getSource()==b11 && mr==-1 && k>2){
String mm = (String)ae.examtype;
if(mm.equals("MCQ")){
if(!(f19.getText().equalsIgnoreCase("a") || f19.getText().equalsIgnoreCase("b") || f19.getText().equalsIgnoreCase("c") || f19.getText().equalsIgnoreCase("d"))){
JOptionPane.showMessageDialog(null,"Please enter a or b or c or d","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
k -= 2;
q.setVisible(false);
String s = Integer.toString(k+1);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
l2 = new JLabel("a : "+aq[k].A,SwingConstants.CENTER);
l3 = new JLabel("b : "+aq[k].B,SwingConstants.LEFT);
l4 = new JLabel("c : "+aq[k].C,SwingConstants.LEFT);
l5 = new JLabel("d : "+aq[k].D,SwingConstants.LEFT);
f19 = new JTextField(ans[k]);
b10 =new JButton("Next");
b11 =new JButton("Back");
q = new Question(label,s,l1,l2,l3,l4,l5,f19,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
if(mm.equals("True/False")){
if(!(r.getText().equalsIgnoreCase("T") || r.getText().equalsIgnoreCase("F"))){
JOptionPane.showMessageDialog(null,"Please enter T for true and F for false","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
k -= 2;
q.setVisible(false);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
r = new JTextField(ans[k]);
String s = Integer.toString(k+1);
b10 =new JButton("Next");
b11 =new JButton("Back");
q = new Question(label,s,l1,r,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
k++;
}
if(e.getSource()==b11 && mr==-1 && k==2){
String mm = (String)ae.examtype;
if(mm.equals("MCQ")){
if(!(f19.getText().equalsIgnoreCase("a") || f19.getText().equalsIgnoreCase("b") || f19.getText().equalsIgnoreCase("c") || f19.getText().equalsIgnoreCase("d"))){
JOptionPane.showMessageDialog(null,"Please enter a or b or c or d","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
k -= 2;
q.setVisible(false);
String s = Integer.toString(k+1);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
l2 = new JLabel("a : "+aq[k].A,SwingConstants.LEFT);
l3 = new JLabel("b : "+aq[k].B,SwingConstants.LEFT);
l4 = new JLabel("c : "+aq[k].C,SwingConstants.LEFT);
l5 = new JLabel("d : "+aq[k].D,SwingConstants.LEFT);
f19 = new JTextField(ans[k]);
b10 =new JButton("Next");
b11 =new JButton("Back");
b11.setEnabled(false);
q = new Question(label,s,l1,l2,l3,l4,l5,f19,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
if(mm.equals("True/False")){
if(!(r.getText().equalsIgnoreCase("T") || r.getText().equalsIgnoreCase("F"))){
JOptionPane.showMessageDialog(null,"Please enter T for true and F for false","Warning",JOptionPane.WARNING_MESSAGE);
return;
}
k -= 2;
q.setVisible(false);
l1 = new JLabel(aq[k].que,SwingConstants.LEFT);
r = new JTextField(ans[k]);
String s = Integer.toString(k+1);
b10 =new JButton("Next");
b11 =new JButton("Back");
b11.setEnabled(false);
q = new Question(label,s,l1,r,b10,b11);
b10.addActionListener(this);
b11.addActionListener(this);
}
k++;
}
}
public static void main(String args[])
{
Student st = new Student();
st.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class TimerThread extends Thread{
public int duration;
public JLabel l1;
public boolean life;
public TimerThread(int d,JLabel label){
super("TimerThread");
duration=d;
l1=label;
life=true;
start();
}
public void run()
{
try{
for(int i=duration-1;i>=0 && life;i--){
for(int j=59;j>=0;j--){
if(j>=10)
l1.setText("Time: "+Integer.toString(i)+":"+Integer.toString(j)+" min");
else
l1.setText("Time: "+Integer.toString(i)+":"+"0"+Integer.toString(j)+" min");
Thread.sleep(1000);
}
}
}
catch(InterruptedException e){
System.out.println("Interrupted Exception");
}
JOptionPane.showMessageDialog(null,"Time is up.");
q.setVisible(false);
if(ae.examtype.equals("MCQ")){
ans[k-1]=f19.getText();
for(int i=0; i<l; i++){
if(ans[i].equalsIgnoreCase(aq[i].ans)){
mark += sum;
}
}
}
if(ae.examtype.equals("True/False")){
ans[k-1]=r.getText();
for(int i=0; i<l; i++){
if(ans[i].equalsIgnoreCase(aq[i].cans)){
mark += sum;
}
}
}
mt.EditMark(field1.getText(),mark);
try{
String s = new String("output");
String s1 = new String("marks_"+f11.getText().toUpperCase()+"_"+f12.getText().toUpperCase()+"_"+f13.getText().toUpperCase()+".txt");
String s2 = new String("marks");
os.writeObject(s);
os.flush();
os.writeObject(s1);
os.flush();
os.writeObject(s2);
os.flush();
os.writeObject(mt);
os.flush();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,"Marks file is not updated");
return;
}
k = 0;
mark = 0;
passAction();
}
}
public void passAction()
{
b1=new JButton("Appear at the exam");
b2=new JButton("View marks");
b3=new JButton("Cancel");
op = new StudentOption(b1,b2,b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
}