using System; using System.Collections.Generic; using System.ComponentModel;
using System.Data; using System.Drawing; using System.Linq; using System.Text;
using System.Threading.Tasks; using System.Windows.Forms; namespace
WindowsFormsApp10{ public partial class Form1 : Form { public Form1() {
InitializeComponent(); } public class Student { public string sno; public string
name; public double chinese; public double math; public double english; public
Student(string sno, string name, double chinese, double math, double english) {
this.sno = sno; this.name = name; this.chinese = chinese; this.math = math; this
.english = english; } public double Sum { get { return chinese + math + english;
} } } public class Grade { Student[] stu = new Student[100]; double[] sum2 = new
double[100]; int i = 0; public Grade() { } // Add students public void Add(Student s) {
stu[i] = s; sum2[i] = stu[i].Sum; i++; } // Query the total score of the specified student int x = 0; int k = 0; bool
flag= false; // Query total score public double getSum(string s) { for (x = 0; x < i; x++) {
if (stu[x].name == s) { k = x; flag = true; } } if (flag == true) { return sum2[
k]; } else { return -1; } } // Average grade of the class double avg = 0; public double getAverage
() { for (int aa = 0; aa < i; aa++) { avg += sum2[aa]; } return avg / i; }
// Highest score in Chinese double maxChinese = 0; public double getChineseMax() { for (int z = 0;
z< i; z++) { if (stu[z].chinese > maxChinese) { maxChinese = stu[z].chinese; }
} return maxChinese; } // Highest score in English double maxMath = 0; public double getMathMax() {
for (int z = 0; z < i; z++) { if (stu[z].math > maxMath) { maxMath = stu[z].math
; } } return maxMath; } // Highest score in English double maxEnglish = 0; public double
getEnglishMax() { for (int z = 0; z < i; z++) { if (stu[z].english > maxEnglish)
{ maxEnglish = stu[z].english; } } return maxEnglish; } // Statistics before class 3 Name list public
string getNames() { Student[] t = new Student[1]; // Intermediate variable t[0] = new Student("",
"", 0, 0, 0); double t2 = 0; for (int xx = 0; xx < i - 1; xx++) { for (int yy =
xx+ 1; yy < i; yy++) { if (sum2[yy] > sum2[xx]) { t2 = sum2[yy]; sum2[yy] = sum2
[xx]; sum2[xx] = t2; t[0] = stu[yy]; stu[yy] = stu[xx]; stu[xx] = t[0]; } } }
return " " + stu[0].name + " " + stu[1].name + " " + stu[2].name; } // A failed student
string md = ""; public string getStudentMenu(string s) { if (s == " chinese ") { for (
int x = 0; x < i; x++) { if (stu[x].chinese < 60) { md += " " + stu[x].name; } }
return " " + md; } else if (s == " mathematics ") { for (int x = 0; x < i; x++) { if (stu[x
].math < 60) { md += " " + stu[x].name; } } return " " + md; } else if (s ==
" English ") { for (int x = 0; x < i; x++) { if (stu[x].english < 60) { md += " " + stu
[x].name; } } return " " + md; } else { return " non-existent ( The course name you entered is incorrect )"; } }
// Percentage of students with different grades public string getStudentBFB(string s) { if (s == " chinese ") { double
yw1= 0; double yw2 = 0; double yw3 = 0; double yw4 = 0; double yw5 = 0; for (
int z = 0; z < i; z++) { if (stu[z].chinese <= 100 && stu[z].chinese >= 90) {
yw1++; } else if (stu[z].chinese < 90 && stu[z].chinese >= 80) { yw2++; } else
if (stu[z].chinese < 80 && stu[z].chinese >= 70) { yw3++; } else if (stu[z].
chinese< 70 && stu[z].chinese >= 60) { yw4++; } else { yw5++; } } return
"\n90-100:" + (yw1 / i) * 100.0 + "%\n80-90:" + (yw2 / i) * 100.0 + "%\n70-80:"
+ (yw3 / i) * 100.0 + "%\n60-70:" + (yw4 / i) * 100.0 + "%\n60 following :" + (yw5 / i) *
100.0 + "%"; } else if (s == " mathematics ") { double yw1 = 0; double yw2 = 0; double yw3
= 0; double yw4 = 0; double yw5 = 0; for (int z = 0; z < i; z++) { if (stu[z].
chinese<= 100 && stu[z].chinese >= 90) { yw1++; } else if (stu[z].chinese < 90
&& stu[z].chinese >= 80) { yw2++; } else if (stu[z].chinese < 80 && stu[z].
chinese>= 70) { yw3++; } else if (stu[z].chinese < 70 && stu[z].chinese >= 60) {
yw4++; } else { yw5++; } } return "\n90-100:" + (yw1 / i) * 100.0 + "%\n80-90:"
+ (yw2 / i) * 100.0 + "%\n70-80:" + (yw3 / i) * 100.0 + "%\n60-70:" + (yw4 / i)
* 100.0 + "%\n60 following :" + (yw5 / i) * 100.0 + "%"; } else if (s == " English ") { double
yw1= 0; double yw2 = 0; double yw3 = 0; double yw4 = 0; double yw5 = 0; for (int
z= 0; z < i; z++) { if (stu[z].chinese <= 100 && stu[z].chinese >= 90) { yw1++;
} else if (stu[z].chinese < 90 && stu[z].chinese >= 80) { yw2++; } else if (stu[
z].chinese < 80 && stu[z].chinese >= 70) { yw3++; } else if (stu[z].chinese < 70
&& stu[z].chinese >= 60) { yw4++; } else { yw5++; } } return "\n90-100:" + (yw1
/ i) * 100.0 + "%\n80-90:" + (yw2 / i) * 100.0 + "%\n70-80:" + (yw3 / i) * 100.0
+ "%\n60-70:" + (yw4 / i) * 100.0 + "%\n60 following :" + (yw5 / i) * 100.0 + "%"; } else
{ return " non-existent ( The course name you entered is incorrect )"; } } } Student[] st1 = new Student[100]; Grade gr =
new Grade(); int i = 0; private void label8_Click(object sender, EventArgs e) {
} private void Form1_Load(object sender, EventArgs e) { label7.Text = ""; }
private void button1_Click(object sender, EventArgs e) { try { st1[i] = new
Student(textBox1.Text, textBox2.Text, Convert.ToInt32(textBox3.Text), Convert.
ToInt32(textBox4.Text), Convert.ToInt32(textBox5.Text)); gr.Add(st1[i]); i++;
label7.Text = " Successfully added " + i + " A student's information "; textBox1.Text = ""; textBox2.Text = "";
textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = "";
} catch { MessageBox.Show(" Input perfect student information to add "); } } private void button2_Click(
object sender, EventArgs e) { label7.Text = ""; if (textBox6.Text.Trim() != "")
{ // Count the average score of the whole class label7.Text += "\n\n The average grade of the whole class : " + Convert.ToString(gr.
getAverage()); // Statistics of the highest score of a single subject label7.Text += "\n\n The highest score of Chinese is :" + Convert.ToString(gr
.getChineseMax()); label7.Text += "\n\n The highest score in mathematics is :" + Convert.ToString(gr.
getMathMax()); label7.Text += "\n\n The highest score in English is :" + Convert.ToString(gr.
getEnglishMax()); // Statistics before class 3 Name list label7.Text += "\n\n The top three in the class are :" + gr.getNames();
// List of students who failed in the specified course label7.Text += "\n\n Designated account “ " + textBox6.Text + " ” Failed list :" + gr.
getStudentMenu(textBox6.Text); // Percentage of students in different score segments of a given course label7.Text += "\n\n Designated account “ "
+ textBox6.Text + " ” The percentages of different fractions are as follows :" + gr.getStudentBFB(textBox6.Text); textBox6.
Text= ""; } else { MessageBox.Show(" Please enter the course name you want to query :"); } } private void
button3_Click(object sender, EventArgs e) { label7.Text = ""; if (textBox7.Text.
Trim() != "") { double result = gr.getSum(textBox7.Text); if (result == -1) {
MessageBox.Show(" The student does not exist !"); } else { label7.Text = " student :" + textBox7.Text + "
The total score is :" + Convert.ToString(result); textBox7.Text = ""; } } else { MessageBox.
Show(" Please enter the name of the student you want to query "); } } private void textBox2_TextChanged(object sender,
EventArgs e) { } private void label8_Click_1(object sender, EventArgs e) { }
private void label9_Click(object sender, EventArgs e) { } } }

Technology
©2019-2020 Toolsou All rights reserved,
Hikvision - Embedded software written test questions C Language application 0 The length of array in memory and structure is 0 In depth analysis data structure --- The preorder of binary tree , Middle order , Subsequent traversal How to do it ipad Transfer of medium and super large files to computer elementui Shuttle box el-transfer Display list content text too long 2019 The 10th Blue Bridge Cup C/C++ A Summary after the National Games ( Beijing Tourism summary )unity Shooting games , Implementation of first person camera python of numpy Module detailed explanation and application case Study notes 【STM32】 Digital steering gear Horizontal and vertical linkage pan tilt Vue Used in Element Open for the first time el-dialog Solution for not getting element