As a team, design a Windows application, and define a student class and class class in the program to process students' student IDs, names, and final exam scores for three courses: Chinese, mathematics, and English.

Design a Windows application in which a student class and a class class are defined to process students' student numbers, names, and final exam scores for three courses: Chinese, mathematics, and English.

Implement the following required functions:

1. Query the student’s total score based on name;
2. Count the average score of the entire class;
3. Count the highest score in a single subject of the class;
4. Count the top three scores in the class;
5. Students The total capacity does not exceed 1000

Design tips:

1. Define a Student class, including fields (student number, name, Chinese score, math score, English score) and attributes (total score), etc.
2. Define a Grade class class, including a Student class array (used to save the information of the entire class), a field representing the number of students, and several methods to implement the above requirements.
3. Design the user operation interface, which is divided into three areas. The first area is the add student area: it allows the user to enter a student's information and click the "Add" button to add the student's information to the student array of the class object. The second area is the query area: the user enters the student's name and clicks the "Query" button to display the student's total score. If the student does not exist, "This student does not exist" is displayed. The third area is the statistics area: click the "Statistics" button to display the average score of the class, the highest score in a single subject, and the list of the top three overall scores.

window design

Window interface design

Code:

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 Project8
{
   
    
    
    public partial class Form1 : Form
    {
   
    
    
        public Form1()
        {
   
    
    
            InitializeComponent();
        }
        Grade grade = new Grade();
        class Student : IComparable<Student>
        {
   
    
    
            public string number;
            public string name;
            public double chinese;
            public double math;
            public double english;
			//构造函数
            public Student(string number, string name, double chinese, double math, double english)
            {
   
    
    
                this.number = number;
                this.name = name

Guess you like

Origin blog.csdn.net/weixin_43057454/article/details/105799047