-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.cs
More file actions
281 lines (258 loc) · 8.64 KB
/
Form1.cs
File metadata and controls
281 lines (258 loc) · 8.64 KB
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
namespace GradingSystem
{
public partial class Form1 : Form
{
public double h1=0,h2=0,h3=0,h4=0,h5=0,h6=0,m=0;
LinkedList L = new LinkedList();
public Form1()
{
InitializeComponent();
}
public string degree(double h)
{
if(h>=98)
return "A+";
else if(h>=92)
return "A";
else if(h>=90)
return "A-";
else if(h>=88)
return "B+";
else if (h >= 82)
return "B";
else if (h >= 80)
return "B-";
else if (h >= 78)
return "C+";
else if (h >= 72)
return "C";
else if (h >= 70)
return "C-";
else if (h >= 68)
return "D+";
else if (h >= 62)
return "D";
else if (h >= 60)
return "D-";
else
return "F";
}
private void Savebtn_Click(object sender, EventArgs e)
{
L.insert(NameLabel_View.Text, idLabel_View.Text, Deg.Text);
Nametxtbox.Text = "";
idtxtbox.Text = "";
midtxtbox.Text = "";
finaltxtbox.Text = "";
quizzestxtbox.Text = "";
attendancetxtbox.Text = "";
projectstxtbox.Text = "";
homeworktxtbox.Text = "";
idLabel_View.Text = "";
NameLabel_View.Text = "";
QuizzesLabel_View.Text = "";
HomeworkLabel_View.Text = "";
midLabel_View.Text = "";
finalLabel_View.Text = "";
AttendanceLabel_View.Text = "";
ProjectsLabel_View.Text = "";
attendance_grade.Text = "";
mid_grade.Text = "";
final_grade.Text = "";
quizzes_grade.Text = "";
projects_grade.Text = "";
homework_grade.Text = "";
homework_grade.Text = "";
saved.Text = "saved!";
timer1.Start();
}
private void searchtxtbox_TextChanged(object sender, EventArgs e)
{
searchtxtbox.ForeColor = Color.FromArgb(35, 41, 70);
}
private void Searchbtn_Click(object sender, EventArgs e)
{
L.search(searchtxtbox.Text);
}
private void searchtxtbox_Enter(object sender, EventArgs e)
{
searchtxtbox.Text = "";
}
//Abdulsayed
private void timer1_Tick(object sender, EventArgs e)
{
saved.Text = string.Empty;
}
private void Resetbtn_Click(object sender, EventArgs e)
{
Nametxtbox.Text = "";
idtxtbox.Text = "";
midtxtbox.Text = "";
finaltxtbox.Text = "";
quizzestxtbox.Text = "";
attendancetxtbox.Text = "";
projectstxtbox.Text = "";
homeworktxtbox.Text = "";
}
private void viewbtn_Click(object sender, EventArgs e)
{
NameLabel_View.Text = Nametxtbox.Text;
idLabel_View.Text = idtxtbox.Text;
////////////////////
QuizzesLabel_View.Text = quizzestxtbox.Text;
if (quizzestxtbox.Text != "")
{
h2 = double.Parse(quizzestxtbox.Text);
h2 = (h2 * 100) / 10;
if (h2 > 100)
{
quizzes_grade.Text = "NaN";
}
else
quizzes_grade.Text = h2.ToString("0.0") + "%";
}
Done_Grade.Text = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4) + "%";
m = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4); Deg.Text = degree(m);
///////////////
AttendanceLabel_View.Text = attendancetxtbox.Text;
if (attendancetxtbox.Text != "")
{
h1 = double.Parse(attendancetxtbox.Text);
h1 = (h1 * 100) / 50;
if (h1 > 100)
{
attendance_grade.Text = "NaN";
}
else
attendance_grade.Text = h1.ToString("0.0") + "%";
}
Done_Grade.Text = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4) + "%";
m = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4); Deg.Text = degree(m);
/////////
ProjectsLabel_View.Text = projectstxtbox.Text;
if (projectstxtbox.Text != "")
{
h3 = double.Parse(projectstxtbox.Text);
h3 = (h3 * 100) / 3;
if (h3 > 100)
{
projects_grade.Text = "NaN";
}
else
projects_grade.Text = h3.ToString("0.0") + "%";
}
Done_Grade.Text = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4) + "%";
m = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4); Deg.Text = degree(m);
///////////
HomeworkLabel_View.Text = homeworktxtbox.Text;
if (homeworktxtbox.Text != "")
{
h4 = double.Parse(homeworktxtbox.Text);
h4 = (h4 * 100) / 20;
if (h4 > 100)
{
homework_grade.Text = "NaN";
}
else
homework_grade.Text = h4.ToString("0.0") + "%";
}
Done_Grade.Text = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4) + "%";
m = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4);
///////////
midLabel_View.Text = midtxtbox.Text;
if (midtxtbox.Text != "")
{
h5 = double.Parse(midtxtbox.Text);
h5 = (h5 * 100) / 50;
if (h5 > 100)
{
mid_grade.Text = "NaN";
}
else
mid_grade.Text = h5.ToString("0.0") + "%";
}
Done_Grade.Text = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4) + "%";
m = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4); Deg.Text = degree(m);
///////////////
finalLabel_View.Text = finaltxtbox.Text;
if (finaltxtbox.Text != "")
{
h6 = double.Parse(finaltxtbox.Text);
h6 = (h6 * 100) / 500;
if (h6 > 100)
{
final_grade.Text = "NaN";
}
else
final_grade.Text = h6.ToString("0.0") + "%";
}
Done_Grade.Text = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4) + "%";
m = (h1 + h2 + h3 + h4 + h5) / 20 + h6 - (h6 / 4); Deg.Text = degree(m);
}
private void Show_Click(object sender, EventArgs e)
{
}
private void finaltxtbox_TextChanged(object sender, EventArgs e)
{
}
private void attendance_grade_Click(object sender, EventArgs e)
{
}
//Abdulsayed
public class Node
{
public string name = "", id = "", degree = "";
public Node? next;
}
internal class LinkedList
{
public int coun=0;
public Node? head;
public void insert(string name, string id, string degree)
{
Node temp = new Node();
temp.name = name;
temp.id = id;
temp.degree = degree;
if (head == null)
{
head = temp;
}
Node? p = head;
while (p.next != null)
{
p = p.next;
}
p.next = temp;
temp.next = null;
coun++;
}
public void search(string id)
{
Node? p = head;
bool found = false;
while (p != null)
{
if (id == p.id)
{
found = true;
break;
}
p = p.next;
}
if (found)
{
MessageBox.Show( "Name : " + p.name + "\n" + "id : " + p.id +"\nYour degree is : " + p.degree, "Found!");
}
else
{
MessageBox.Show("Not Found!");
}
}
public void size()
{
Console.WriteLine("LinkedList size = {0}", coun);
}
}
}
}