《学生管理系统》PPT课件.ppt

上传人:牧羊曲112 文档编号:5492429 上传时间:2023-07-13 格式:PPT 页数:18 大小:447KB
返回 下载 相关 举报
《学生管理系统》PPT课件.ppt_第1页
第1页 / 共18页
《学生管理系统》PPT课件.ppt_第2页
第2页 / 共18页
《学生管理系统》PPT课件.ppt_第3页
第3页 / 共18页
《学生管理系统》PPT课件.ppt_第4页
第4页 / 共18页
《学生管理系统》PPT课件.ppt_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《《学生管理系统》PPT课件.ppt》由会员分享,可在线阅读,更多相关《《学生管理系统》PPT课件.ppt(18页珍藏版)》请在三一办公上搜索。

1、C#程序设计,学生管理系统,1,设计一个windows应用程序,在该课程中定义一个(class学生类)和(class班级类),以处理每个学生(int 学号),(string姓名),(double语文,数学和英语)三门课程的期末考试成绩,要求:1、能根据姓名查询指定学生的总成绩(学生类中 double 数学+语文+英语 new class student student.sum方法1 sum=+)2、能统计单科最高分(该科班级最高分)3、能统计班级总分前三名的名单4、能统计指定课程在不同分数段的学生人数百分比提示:1、定义一个Student类,包含字段(学号,姓名,语文成绩,数学成绩,英语成绩)

2、和属性(总成绩)2、定义一个Grade班级类,包含一个Student类型的数组(用于保存全班学生的信息)以及实现上述要求的方法3、设计用户界面,首先能输入一个学生的信息(输入成绩),但点击“添加”按钮时,将信息加入到班级对象的学生数组中。当点击“完成”按钮时调用班级类的方法来显示各种统计结果。当用户输入学生姓名点击“查询”按钮显示该生的总成绩。,新建student类。,using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace WindowsFormsApplicatio

3、n1 class Student/定义 学号,姓名,语文成绩,数学成绩,英语成绩,总成绩 public string stuNo;public string name;public double chinese;public double math;public double english;public double sumScore get return chinese+math+english;,新建Grade类,namespace WindowsFormsApplication1 class Grade:Student int snums;public Student stu=new

4、Student50;/定义构造函数 public Grade()snums=0;public void addstu(Student s)/添加数据 stusnums=s;snums+;public int searchstu(string name)/查询数据 int i;for(i=0;i snums;i+)if(stui.name=name)break;if(i=snums)return-1;else return i;,新建Grade类,public void ProThree()/给所有成绩排序,用后面实现前三名的排名(主要利用排序实现对成绩的排名)for(int i=0;i stu

5、k.sumScore)k=j;if(k!=i)Student temp;temp=stuk;stuk=stui;stui=temp;,新建Grade类,/显示单科成绩的最高分 public int HighScore(int k)/构造一个函数实现对分数的比较 int p=0;if(k=0)for(int i=1;i stup.math)p=i;else if(k=1)for(int i=1;i stup.chinese)p=i;else for(int i=1;i stup.english)p=i;return p;,新建Grade类,public string getHL()/调用High

6、Score函数 string Maxer=;Maxer+=单科语文最高分:+stuHighScore(1).name+n;Maxer+=单科数学最高分:+stuHighScore(0).name+n;Maxer+=单科英语最高分:+stuHighScore(2).name+n;return Maxer+n;/全班的平均成绩 public string SumScore()double sum=0;double avg=0;for(int i=0;i snums;i+)sum=sum+stui.sumScore;avg=sum/snums;return 班级总分平均分:+avg;,新建Grade

7、类,/语文成绩各分数段百分比 public string PerC()double per1,per2,per3,per4,per5;double sumC1=0,sumC2=0,sumC3=0,sumC4=0,sumC5=0;for(int i=0;i 90),新建Grade类,/数学成绩各分数段百分比 public string PerM()double per1,per2,per3,per4,per5;double sumC1=0,sumC2=0,sumC3=0,sumC4=0,sumC5=0;for(int i=0;i 90),新建Grade类,public string PerE()

8、/英语成绩各分数段百分比 double per1,per2,per3,per4,per5;double sumC1=0,sumC2=0,sumC3=0,sumC4=0,sumC5=0;for(int i=0;i 90),Form1.cs,public partial class Form1:Form Grade g1=new Grade();public Form1()InitializeComponent();private void button1_Click(object sender,EventArgs e)/实现添加数据按钮 Student s=new Student();s.stu

9、No=textBox1.Text;s.name=textBox2.Text;s.chinese=Convert.ToDouble(textBox3.Text);s.math=Convert.ToDouble(textBox4.Text);s.english=Convert.ToDouble(textBox5.Text);g1.addstu(s);MessageBox.Show(添加成功);,新建Grade类,private void button2_Click(object sender,EventArgs e)ClearInfo();/调用实现清屏函数从而实现清屏。private void

10、ClearInfo()/构造实现清屏函数。textBox1.Clear();textBox2.Clear();textBox3.Clear();textBox4.Clear();textBox5.Clear();textBox6.Clear();private void button4_Click(object sender,EventArgs e)/实现查询按钮,在TextBox6上显示 int pos=g1.searchstu(this.textBox6.Text);if(pos!=-1)label6.Text=this.textBox6.Text+的总成绩:+g1.stupos.sumS

11、core;else MessageBox.Show(不存在这个人!);,新建Grade类,private void button3_Click(object sender,EventArgs e)/实现完成按钮 label6.Text=班级总分前三名的名单:+n;for(int i=0;i 3;i+)g1.ProThree();label6.Text+=g1.stui.name+n;label6.Text+=g1.getHL()+n;label6.Text+=Convert.ToString(g1.SumScore()+n;label6.Text+=g1.PerC()+n;label6.Tex

12、t+=g1.PerM()+n;label6.Text+=g1.PerE()+n;,新建Grade类,private void button3_Click(object sender,EventArgs e)/实现完成按钮 label6.Text=班级总分前三名的名单:+n;for(int i=0;i 3;i+)g1.ProThree();label6.Text+=g1.stui.name+n;label6.Text+=g1.getHL()+n;label6.Text+=Convert.ToString(g1.SumScore()+n;label6.Text+=g1.PerC()+n;label6.Text+=g1.PerM()+n;label6.Text+=g1.PerE()+n;,添加数据,01 小明 语文 70 数学 65 英语8502 小红 语文 78 数学 80 英语9301 康康 语文 80 数学 96 英语7601 迈克 语文 40 数学 30 英语66,谢谢大家!,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号