通用学生信息管理系统c#程序报告材料.docx
- 文档编号:882043
- 上传时间:2022-10-13
- 格式:DOCX
- 页数:28
- 大小:691.16KB
通用学生信息管理系统c#程序报告材料.docx
《通用学生信息管理系统c#程序报告材料.docx》由会员分享,可在线阅读,更多相关《通用学生信息管理系统c#程序报告材料.docx(28页珍藏版)》请在冰豆网上搜索。
通用学生信息管理系统c#程序报告材料
一、题目
通用学生信息管理系统
二、根本功能要求
1.创建相应的成员变量保存学生根本信息;
2.创建相应属性和索引以实现对成员变量访问的封装;
3.创建相应的方法以实现对学生根本信息的管理;
4.创建相应的方法以实现对学生成绩的管理;
5.应用构造函数和析构函数;
6.派生小学生、中学生、大学生等子类;
7.运用继承、多态、重载、覆盖、接口、抽象类、代理、事件等。
三、题目分析
1.添加两个接口,定义成员便量如:
学生、性别等与科目信息;
2.添加抽象类student,实现接口与定义接口的属性成员。
构造函数student〔〕用于学生信息的赋值。
添加input〔〕方法,实现对成员变量的输入;添加show〔〕方法和sumScore〔〕方法对成员变量的数据输出与处理;添加一系列对于学生信息与成绩的管理的方法如changeChinese方法〔修改语文成绩〕等。
3.定义派生类pupil,middleSchoolStu,collegeStu,并使用base关键字调用基类构造函数与添加额外的参数。
在每个派生类中重写inpt〔〕,show〔〕,sumScore〔〕方法便于调用;再额外添加一系列对于学生信息与成绩的管理的方法以实现在主函数中的管理功能。
4.在主函数中分别实现对大学生、中学生、小学生信息的一系列的管理功能:
录入、浏览、查询、删除、修改。
四、功能设计
基类Student实现接口IstuInformation和IstuScore;
派生类pupil继承基类Student,
中学生middleSchoolStu类继承pupil类,
大学生collegeStu类继承middleSchoolStu类;
五、源程序代码
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespacestudentInformationManagement
{
interfaceIstuInformation//第一个接口
{
stringStuName{get;set;}//接口属性,获取学生
stringStuSex{get;set;}//接口属性,获取学生性别
stringStuAge{get;set;}//接口属性,获取学生年龄
stringStuNatPlace{get;set;}//接口属性,获取学生籍贯
}
interfaceIstuScore//第二个接口
{
floatChineseScore{get;set;}//接口属性,获取学生语文成绩
floatMathScore{get;set;}//接口属性,获取学生数学成绩
}
//定义一个实现两个接口的抽象类student〔基类〕,不能产生任何实例
publicabstractclassStudent:
IstuInformation,IstuScore
{
//定义私有成员
privatestringstuName;
privatestringstuSex;
privatestringstuAge;
privatestringstuNatPlace;
privatefloatchineseScore;
privatefloatmathScore;
//定义接口的属性成员
publicstringStuName//用于访问私有变量stuName的属性
{
get{returnstuName;}//get方法向外部返回属性成员的值
set{stuName=value;}//set方法将外部写入的值用value关键字赋值给属性成员
}
publicstringStuSex//用于访问私有变量stuSex的属性
{
get{returnstuSex;}
set{stuSex=value;}
}
publicstringStuAge//用于访问私有变量stuAge的属性
{
get{returnstuAge;}
set{stuAge=value;}
}
publicstringStuNatPlace//用于访问私有变量stuNatPlace的属性
{
get{returnstuNatPlace;}
set{stuNatPlace=value;}
}
publicfloatChineseScore//用于访问私有变量chineseScore的属性
{
get{returnchineseScore;}
set{chineseScore=value;}
}
publicfloatMathScore//用于访问私有变量mathScore的属性
{
get{returnmathScore;}
set{mathScore=value;}
}
//构造函数
publicStudent(stringstuName,stringstuSex,stringstuAge,stringstuNatPlace,floatchineseScore,floatmathScore)
{
this.stuName=stuName;//用this关键字调用当前类的成员,赋值
this.stuSex=stuSex;
this.stuAge=stuAge;
this.stuNatPlace=stuNatPlace;
this.chineseScore=chineseScore;
this.mathScore=mathScore;
}
//析构函数
~Student(){}
//定义一个表示输入数据成员的虚方法
publicvirtualvoidinput()
{
Console.WriteLine("请输入要录入的学生的根本信息和成绩:
");
Console.Write(":
");
StuName=Console.ReadLine();
Console.Write("性别:
");
StuSex=Console.ReadLine();
Console.Write("年龄:
");
StuAge=Console.ReadLine();
Console.Write("籍贯:
");
StuNatPlace=Console.ReadLine();
Console.Write("语文:
");
ChineseScore=float.Parse(Console.ReadLine());
Console.Write("数学:
");
MathScore=float.Parse(Console.ReadLine());
}
//定义抽象方法,具体容在派生类中实现
publicabstractvoidshow();//输出学生信息的方法
publicabstractvoidsumScore();//输出学生成绩总分与平均分的方法
//定义方法来对学生信息与成绩的处理
publicvoidchangeStuAge(stringage)//修改学生年龄
{
stuAge=age;
Console.WriteLine("修改成功!
");
}
publicvoidchangeStuNatPlace(stringnation)//修改学生籍贯
{
stuNatPlace=nation;
Console.WriteLine("修改成功!
");
}
publicvoidchangeChinese(floatchinese)//修改学生语文成绩
{
chineseScore=chinese;
Console.WriteLine("修改成功!
");
}
}
//继承抽象类student,形成pupil子类
classpupil:
Student
{
protectedfloatenglishScore;
//构造函数,继承
publicpupil(stringstuName,stringstuSex,stringstuAge,stringstuNatPlace,floatchineseScore,floatmathScore,floatenglishScore)
:
base(stuName,stuSex,stuAge,stuNatPlace,chineseScore,mathScore)//通过base关键字调用基类构造函数
{}
//析构函数
~pupil(){}
//重写基类的虚方法,增加成员
publicoverridevoidinput()
{
base.input();//用base关键字访问基类的input〔〕方法
Console.Write("英语:
");
englishScore=float.Parse(Console.ReadLine());
}
publicoverridevoidshow()//重写基类中的定义抽象的方法
{
Console.WriteLine("学生根本信息:
");
Console.WriteLine(":
{0},性别:
{1},年龄:
{2},籍贯:
{3}",StuName,StuSex,StuAge,StuNatPlace);
Console.WriteLine("学生成绩信息:
");
Console.WriteLine("语文:
{0},数学:
{1},英语:
{2}",ChineseScore,MathScore,englishScore);
}
publicoverridevoidsumScore()//重写基类中的定义抽象的方法
{
floatsum=ChineseScore+MathScore+englishScore;
floataverage=sum/3;
Console.WriteLine("总成绩:
{0},平均分:
{1}",sum,average);
}
//定义带引用型和输出型参数的方法成员,包含的是数据的存储地址
publicvoidsearchStuName(refstringName,outintw)//查找学生
{
if(Name==StuName)
w=1;
else
w=0;
}
publicvoidchangeEnglish(floatenglish)//修改学生英语成绩
{
englishScore=english;
Console.WriteLine("修改成功!
");
}
}
//定义中学生类,继承小学生类
classmiddleSchoolStu:
pupil
{
protectedstringcontactWay;
protectedfloatphysicsScore;
protect
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 通用 学生 信息管理 系统 c# 程序 报告 材料