《java》学生成绩管理系统.docx

上传人:b****5 文档编号:5795542 上传时间:2023-01-01 格式:DOCX 页数:20 大小:117.55KB
下载 相关 举报
《java》学生成绩管理系统.docx_第1页
第1页 / 共20页
《java》学生成绩管理系统.docx_第2页
第2页 / 共20页
《java》学生成绩管理系统.docx_第3页
第3页 / 共20页
《java》学生成绩管理系统.docx_第4页
第4页 / 共20页
《java》学生成绩管理系统.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

《java》学生成绩管理系统.docx

《《java》学生成绩管理系统.docx》由会员分享,可在线阅读,更多相关《《java》学生成绩管理系统.docx(20页珍藏版)》请在冰豆网上搜索。

《java》学生成绩管理系统.docx

《java》学生成绩管理系统

《面向对象程序设计》课程设计报告

 

设计题目:

学生成绩管理系统

 

计算机与数据科学学院

2019年6月25日

 

1课程设计目的

课程设计主要锻炼学生的动手能力,学生灵活运用书中和实验中所学习的各类知识和技巧,并且能在程序开发中得以很好的运用和发挥。

学生成绩管理系统是学校必不可少的,方便老师对庞大数量学生成绩的统计,也方便了学生查询成绩。

学生成绩管理系统涉及java方法的实例化、数组的运用等知识,不仅使学生复习了以前的知识,还令学生对所学知识结构化,完整化。

此次课程设计不仅巩固以前所学过的知识,还需要学生学习一些在书本上所没有学到过的知识。

通过这次课程设计让自己懂得理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,从理论中得出结论,才能真正为社会服务,从而提高自己的实际动手能力和独立思考的能力。

2课程设计内容

2.1课程设计简介

设计的是学生成绩管理系统,拥有添加学生、删除学生、查询学生、修改学生、打印学生以及统计学生总计六个功能。

2.2设计说明

在设计中,用数组来存储学生,查找学生时,将学号作为关键字来进行查找;删除学生则将该学生所在数组编号值为空,再将其之后的元素向前移动一位;其中还能得出学生语文、数学、英语三门课程的最低分和最高分。

2.3设计流程图

系统模块图

本系统分为六个模块:

添加模块、删除模块、查询模块、修改模块、打印模块以及统计模块。

图2-1系统模块图

函数图

 

图2-2函数图

2.4实现功能

2.4.1添加学生

publicvoidaddStudent(Studenta){

intc=0;

for(inti=0;i

if(student[i]==null){

System.out.println("输入学号:

");

a.setStuno(input.nextLine());

System.out.println("输入姓名:

");

a.setName(input.nextLine());

System.out.println("输入语文成绩:

");

a.setchinese(input.nextFloat());

System.out.println("输入数学成绩:

");

a.setMath(input.nextFloat());

System.out.println("输入英语成绩:

");

a.setEnglish(input.nextFloat());

for(intj=0;j

if(student[j]!

=null)

c++;

}

student[c]=a;

System.out.println("添加成功!

");

break;

}

}

}

2.4.2删除学生

publicvoiddeleteStudent(Stringstuno){

for(inti=0;i<=studentNum;i++){

if(student[i].stuno.equals(stuno)){

System.out.println("删除成功!

");

student[i]=null;//删除时令该数组元素值为空

for(intj=i;j

student[j]=student[j+1];//将后面的值依次向前赋值

}

break;

}

System.out.println("没有此学号的学生!

");

}

}

2.4.3查询学生

publicvoidsearchStudent(Stringstuno){

for(inti=0;i<=studentNum;i++){

if(student[i].stuno.equals(stuno)){

System.out.println("查找成功!

");

System.out.println("学号:

"+student[i].stuno+"姓名:

"+student[i].name+

"数学成绩:

"+student[i].math+"英语成绩:

"+student[i].english+"语文成绩:

"

+student[i].chinese);

break;

}else{

System.out.println("没有此学号学生!

请重新查询");

}

}

}

2.4.4修改学生

publicvoidalterStudent(Stringstuno,Studenta){

for(inti=0;i<=studentNum;i++){

if(student[i].stuno.equals(stuno)){

System.out.println("修改后学号:

");

a.setStuno(input.nextLine());

System.out.println("修改后姓名:

");

a.setName(input.nextLine());

System.out.println("修改后数学成绩:

");

a.setMath(input.nextFloat());

System.out.println("修改后英语成绩:

");

a.setEnglish(input.nextFloat());

System.out.println("修改后语文成绩:

");

a.setchinese(input.nextFloat());

student[i]=a;

System.out.println("修改成功!

");

break;

}

System.out.println("没有此学号的学生!

");

}

}

2.4.5打印学生

publicvoidprintStudent(){

System.out.println(studentNum);

for(inti=0;i<=studentNum;i++){

if(student[i]!

=null){

System.out.println("学号:

"+student[i].stuno+"姓名:

"+student[i].name+

"数学成绩:

"+student[i].math+"英语成绩:

"+student[i].english+"语文成绩"

+student[i].chinese);

}

}

}

2.4.6统计学生

publicvoidinfoStudent(){

inti=0;

while(student[i]!

=null){

i++;

}

System.out.println("共用学生"+i+"名");

}

菜单栏:

publicstaticvoidmain(String[]args){

//TODO自动生成的方法存根

//菜单:

添加学生、删除学生,查找学生、修改学生、打印学生

//使用数组来实现对多个学生的管理

System.out.println("\n\n\t欢迎使用学生成绩管理系统");

System.out.println("**********************************");

System.out.println("1、添加学生\n2、删除学生\n3、查询学生\n4、修改学生\n5、打印学生\n6、统计学生\n7、退出系统");

booleanflag=true;

while(flag){

Studenta=newStudent();

StudentGuanlid=newStudentGuanli();

in2=newScanner(System.in);

System.out.println("输入你选择的功能:

");

ints=in2.nextInt();

switch(s){

case1:

System.out.println("输入你要添加学生的信息:

");

d.addStudent(a);

break;

case2:

System.out.println("输入你要删除的学生的学号:

");

Scannerst=newScanner(System.in);

Stringn=st.nextLine();

d.deleteStudent(n);

break;

case3:

System.out.println("输入你要查询的学生的学号:

");

Scannerst1=newScanner(System.in);

Stringhao=st1.nextLine();

d.searchStudent(hao);

break;

case4:

System.out.println("输入你要修改学生的学号:

");

Scannerst2=newScanner(System.in);

Stringxiu=st2.nextLine();

d.alterStudent(xiu,a);

break;

case5:

d.printStudent();

break;

case6:

d.infoStudent();

break;

default:

System.out.println("\t感谢使用学生管理系统!

");

flag=false;

break;

}

}

}

}

3源代码

类Student:

packagetest;

publicclassStudent{

//学号、姓名、3门课程“数学”、“英语”和“语文”的成绩,包括的方法有计算3门课程的“总分”、“平均分”、“最高分”及“最低分”

Stringstuno,name;//定义学号、姓名

floatmath,english,chinese;

publicStudent(Stringstuno,Stringname,floatmath,floatenglish,floatchinese){

this.stuno=stuno;

this.name=name;

this.chinese=chinese;

this.math=math;

this.english=english;

}

publicStudent(){

//TODO自动生成的构造函数存根

}

publicvoidsetStuno(Stringstuno){

this.stuno=stuno;

}

publicvoidsetName(Stringname){

this.name=name;

}

publicvoidsetMath(floatmath){

this.math=math;

}

publicvoidsetEnglish(floatenglish){

this.english=english;

}

publicvoidsetchinese(floatchinese){

this.chinese=chinese;

}

publicStringgetStuno(){

returnthis.stuno;

}

publicStringgetName(){

returnthis.name;

}

publicfloatgetMath(){

returnmath;

}

publicfloatgetEnglish(){

returnenglish;

}

publicfloatgetchinese(){

returnchinese;

}

publicfloatsum(){

returnmath+english+chinese;

}

publicfloatavg(){

return(math+english+chinese)/3;

}

publicfloatmax(){

if(math>english){

if(math>chinese){

returnmath;

}else{

returnchinese;

}

}else{

if(english>chinese){

returnenglish;

}

else{

returnmath;

}

}

}

publicfloatmin(){

if(math

if(math

returnmath;

}else{

returnchinese;

}

}else{

if(english

returnenglish;

}

else{

returnmath;

}

}

}

}

类StudentGuanli

packagetest;

importjava.util.Scanner;

publicclassStudentGuanli{

staticStudentstudent[]=newStudent[100];

Scannerinput=newScanner(System.in);

privatestaticScannerin2;

//得到当前数组中学生的数量

intstudentNum=this.getStudentNum();

publicintgetStudentNum(){

inti=0;

while(student[i]!

=null){

i++;

}

returni;

}

//添加学生的方法

publicvoidaddStudent(Studenta){

intc=0;

for(inti=0;i

if(student[i]==null){

System.out.println("输入学号:

");

a.setStuno(input.nextLine());

System.out.println("输入姓名:

");

a.setName(input.nextLine());

System.out.println("输入语文成绩:

");

a.setchinese(input.nextFloat());

System.out.println("输入数学成绩:

");

a.setMath(input.nextFloat());

System.out.println("输入英语成绩:

");

a.setEnglish(input.nextFloat());

for(intj=0;j

if(student[j]!

=null)

c++;

}

student[c]=a;

System.out.println("添加成功!

");

break;

}

}

}

//删除学生的方法

publicvoiddeleteStudent(Stringstuno){

for(inti=0;i<=studentNum;i++){

if(student[i].stuno.equals(stuno)){

System.out.println("删除成功!

");

student[i]=null;

for(intj=i;j

student[j]=student[j+1];//将后面的值依次向前赋值

}

break;

}

System.out.println("没有此学号的学生!

");

}

}

//查找学生的方法

publicvoidsearchStudent(Stringstuno){

for(inti=0;i<=studentNum;i++){

if(student[i].stuno.equals(stuno)){

System.out.println("查找成功!

");

System.out.println("学号:

"+student[i].stuno+"姓名:

"+student[i].name+

"数学成绩:

"+student[i].math+"英语成绩:

"+student[i].english+"语文成绩:

"

+student[i].chinese);

break;

}else{

System.out.println("没有此学号学生!

请重新查询");

}

}

}

//修改学生的方法

publicvoidalterStudent(Stringstuno,Studenta){

for(inti=0;i<=studentNum;i++){

if(student[i].stuno.equals(stuno)){

System.out.println("修改后学号:

");

a.setStuno(input.nextLine());

System.out.println("修改后姓名:

");

a.setName(input.nextLine());

System.out.println("修改后数学成绩:

");

a.setMath(input.nextFloat());

System.out.println("修改后英语成绩:

");

a.setEnglish(input.nextFloat());

System.out.println("修改后语文成绩:

");

a.setchinese(input.nextFloat());

student[i]=a;

System.out.println("修改成功!

");

break;

}

System.out.println("没有此学号的学生!

");

}

}

//打印学生的方法

publicvoidprintStudent(){

System.out.println(studentNum);

for(inti=0;i<=studentNum;i++){

if(student[i]!

=null){

System.out.println("学号:

"+student[i].stuno+"姓名:

"+student[i].name+

"数学成绩:

"+student[i].math+"英语成绩:

"+student[i].english+"语文成绩"

+student[i].chinese);

}

}

}

//统计学生的方法

publicvoidinfoStudent(){

inti=0;

while(student[i]!

=null){

i++;

}

System.out.println("共用学生"+i+"名");

}

publicstaticvoidmain(String[]args){

//TODO自动生成的方法存根

//菜单:

添加学生、删除学生,查找学生、修改学生、打印学生

//使用数组来实现对多个学生的管理

System.out.println("\n\n\t欢迎使用学生成绩管理系统");

System.out.println("**********************************");

System.out.println("1、添加学生\n2、删除学生\n3、查询学生\n4、修改学生\n5、打印学生\n6、统计学生\n7、退出系统");

booleanflag=true;

while(flag){

Studenta=newStudent();

StudentGuanlid=newStudentGuanli();

in2=newScanner(System.in);

System.out.println("输入你选择的功能:

");

ints=in2.nextInt();

switch(s){

case1:

System.out.println("输入你要添加学生的信息:

");

d.addStudent(a);

break;

case2:

System.out.println("输入你要删除的学生的学号:

");

Scannerst=newScanner(System.in);

Stringn=st.nextLine();

d.deleteStudent(n);

break;

case3:

System.out.println("输入你要查询的学生的学号:

");

Scannerst1=newScanner(System.in);

Stringhao=st1.nextLine();

d.searchStudent(hao);

break;

case4:

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

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1