-
Notifications
You must be signed in to change notification settings - Fork 1
/
Eligible.java
181 lines (157 loc) · 5.72 KB
/
Eligible.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
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import static javax.swing.JOptionPane.showMessageDialog;
public class Eligible extends JFrame implements ActionListener
{
private JLabel eligibleheading,eligibleheading1,eligibleheading2,eligibleheading3;
private JTextArea output;
private JButton display,back;
Container con=null;
Eligible()
{
super("Placement Eligibility");
con = getContentPane();
con.setLayout(null);
Color lightBlue = new Color(0,255,255);
con.setBackground(lightBlue);
con.setSize(300,300);
con.setLayout(null);
con.setVisible(true);
Font font = new Font("Verdana", Font.BOLD, 16);
Color blue = new Color(30,144,255);
eligibleheading=new JLabel("PLACEMENT ELIGIBILITY");
eligibleheading.setBounds(550, 5, 700,20);
eligibleheading.setFont(font);
eligibleheading.setForeground(Color.BLACK);
eligibleheading1=new JLabel("PLATINUM PACKAGE: CGPA>=8 AND NO BACKLOGS ALLOWED");
eligibleheading1.setBounds(200, 50, 700,20);
eligibleheading1.setFont(font);
eligibleheading1.setForeground(Color.BLACK);
eligibleheading2=new JLabel("GOLD PACKAGE: CGPA>=7 AND NO BACKLOGS ALLOWED");
eligibleheading2.setBounds(200, 75, 700,20);
eligibleheading2.setFont(font);
eligibleheading2.setForeground(Color.BLACK);
eligibleheading3=new JLabel("SILVER PACKAGE: CGPA>=6");
eligibleheading3.setBounds(200, 100, 700,20);
eligibleheading3.setFont(font);
eligibleheading3.setForeground(Color.BLACK);
output=new JTextArea();
output.setBounds(100, 150, 1150,450);
output.setFont(font);
output.setForeground(Color.BLACK);
output.setEditable(false);
display = new JButton("Display");
display.setBounds(400,600,150,40);
display.addActionListener(this);
display.setFont(font);
Color pul = new Color(0,0,255);
Border bored = BorderFactory.createLineBorder(pul,5);
display.setBorder(bored);
display.setForeground(Color.WHITE);
display.setBackground(blue);
back = new JButton("Go Back");
back.setBounds(600,600,150,40);
back.addActionListener(this);
back.setFont(font);
back.setBorder(bored);
back.setForeground(Color.WHITE);
back.setBackground(blue);
con.add(eligibleheading);
con.add(eligibleheading1);
con.add(eligibleheading2);
con.add(eligibleheading3);
con.add(output);
con.add(display);
con.add(back);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==display)
{
try
{
System.out.println("Eligibilty Checked and Displayed");
String name, cgpa1, nob1, r,b,e="";
double cgpa, nob;
File temp = new File("temp.txt");
Boolean createNewFile1 = temp.createNewFile();
BufferedWriter pw = new BufferedWriter(new FileWriter(temp));
BufferedReader br = new BufferedReader(new FileReader("student.txt"));
while((r = br.readLine()) != null )
{
String[] result = r.split("\\|");
name=result[0];
cgpa1=result[4];
nob1=result[5];
cgpa = Double.parseDouble(cgpa1);
nob = Double.parseDouble(nob1);
if(cgpa!=999)
{
if(cgpa >= 8.0 && nob == 0)
{
b = name + " : " + "Candidate Eligible For Platinum,Gold, Silver Packages";
e="Eligible companies: Google (24LPA), Amazon (19LPA), Adobe (11LPA), Flipkart (18LPA), Ebay (6LPA), Infosys (4LPA)";
pw.write(b+"\n");
pw.write(e+"\n\n");
}
else if(cgpa >= 7.0 && nob == 0)
{
b = name + " : " + "Candidate Eligible For Gold and Silver Packages";
e="Eligible companies: ANZ (11LPA), Capgemini (8LPA), Cognizant (6LPA), Wipro (4LPA)";
pw.write(b+"\n");
pw.write(e+"\n\n");
}
else if(cgpa >= 6.0)
{
b = name + " : " + "Candidate Eligible For only Silver Package";
e="Eligible companies: Cognizant (6LPA), Wipro (4LPA)";
pw.write(b+"\n");
pw.write(e+"\n\n");
}
else
{
b = name + " : " + "Sorry!! Candidate Not Eligible";
pw.write(b+"\n\n");
}
}
}
br.close();
pw.close();
File file = new File("temp.txt");
BufferedReader br1 = new BufferedReader(new FileReader(file));
output.read(br1,null);
br1.close();
output.requestFocus();
file.delete();
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(ae.getSource()==back)
{
try
{
this.dispose();
Home h=new Home();
h.setSize(2300,790);
h.setVisible(true);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public static void main(String args[])
{
Eligible eli=new Eligible();
eli.setSize(2300,790);
eli.setVisible(true);
}
}