程序设计思路:分别建立两个类:ScoreInformation类(用来定义学生的基本信息以及设置set和get函数)ScoreManagement类(用来定义实现学生考试成绩录入,考试成绩修改,绩点计算等功能的函数)和一个主函数Text类 (通过输入的数字选项进行功能的实现,因为退出系统代码量极少,所以在主函数中实现此功能)

程序源代码及注释

ScoreInformation类:

 //信1805-3 20183658 王兵兵
package adc; public class ScoreInformation
{
private String stunumber; //学生学号
private String name; //学生姓名
private double mathematicsscore; //高等数学
private double englishscore; //大学英语
private double networkscore; //计算机网络
private double databasescore; //数据库
private double softwarescore; //软件工程
ScoreInformation(String stunumber,String name,double mathematicsscore,double englishscore,double networkscore,double databasescore, double softwarescore)
{ //通过构造函数默认赋值
this.stunumber=stunumber;
this.name=name;
this.mathematicsscore=mathematicsscore;
this.englishscore=englishscore;
this.networkscore=networkscore;
this.databasescore=databasescore;
this.softwarescore=softwarescore;
}
public void setstunumber(String stunumber) //对学生的学号进行赋值操作
{
this.stunumber=stunumber;
}
public void setname(String name) //对学生的姓名进行赋值操作
{
this.name=name;
}
public void setmathematicsscore(double mathematicsscore) //对学生的高等数学成绩进行赋值操作
{
this.mathematicsscore=mathematicsscore;
}
public void setenglishscore(double englishscore) //对学生的大学英语成绩进行赋值操作
{
this.englishscore=englishscore;
}
public void setnetworkscore(double networkscore) //对学生的计算机网络成绩进行赋值操作
{
this.networkscore=networkscore;
}
public void setdatabasescore(double databasescore) //对学生的数据库成绩进行赋值操作
{
this.databasescore=databasescore;
}
public void setsoftwarescore(double softwarescore) //对学生的软件工程成绩进行赋值操作
{
this.softwarescore=softwarescore;
}
public String getstunumber() //返回学生的学号
{
return this.stunumber;
}
public String getname() //返回学生的姓名
{
return this.name;
}
public double getmathematicsscore() //返回学生的高等数学成绩
{
return this.mathematicsscore;
}
public double getenglishscore() //返回学生的大学英语成绩
{
return this.englishscore;
}
public double getnetworkscore() //返回学生的计算机网络成绩
{
return this.networkscore;
}
public double getdatabasescore() //返回学生的数据库成绩
{
return this.databasescore;
}
public double getsoftwarescore() //返回学生的软件工程成绩
{
return this.softwarescore;
} }

ScoreManagement类

 package adc;
import java.util.Scanner;
public class ScoreMangerment
{
int j=0;
Scanner te=new Scanner(System.in);
ScoreInformation[] SI=new ScoreInformation[100]; //定义一个学生学籍信息的数组
ScoreMangerment()
{ //利用构造函数初始化5个学生的信息
SI[0]=new ScoreInformation("20183658","王兵兵",0,0,0,0,0);
SI[1]=new ScoreInformation("20183659","张三",0,0,0,0,0);
SI[2]=new ScoreInformation("20183660","李四",0,0,0,0,0);
SI[3]=new ScoreInformation("20183661","王无",0,0,0,0,0);
SI[4]=new ScoreInformation("20183662","李六",0,0,0,0,0);
}
public void meau() //输出系统主界面函数
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系");
System.out.println(" \t学籍管理系统系统2019版");
System.out.println("********************************************************");
System.out.println(" 1、学生考试成绩录入");
System.out.println(" 2、学生考试成绩修改");
System.out.println(" 3、计算学生成绩绩点");
System.out.println(" 4、退出学籍管理系统");
System.out.println("********************************************************");
}
public void scorerecord() //功能1:实现学生信息的录入
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 请输入考生学号:");
System.out.println("********************************************************");
while(!getanswer()) //用来保证学生的输入的学号存在,否则一直输入,直到输入学生学号存在为止
{
System.out.println("你输入的学号有误或不存在!");
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 请输入考生学号:");
System.out.println("********************************************************");
}
scoreluruPrint1(j);
while(!pandun1()) //输入Y或N时对应的程序操作
{
scoreluruPrint1(j); //输入N返回录入界面
}
meau(); //输入Y后返回主界面
}
public Boolean getanswer() //检查学号是否存在
{
String a=te.next();
Boolean temp=false;
for(int i=0;i<5;i++)
{
if(a.equals(SI[i].getstunumber()))
{
temp=true;
j=i;
break;
}
}
return temp;
}
public void scoreluruPrint1(int j) //实现学生成绩信息的输入,并且在输入完一科成绩后进行学生信息的更新
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 请输入高等数学成绩:");
System.out.println("********************************************************");
SI[5]=new ScoreInformation(" "," ",0,0,0,0,0);
SI[5].setstunumber(SI[j].getstunumber());
SI[5].setname(SI[j].getname());
double temp1=te.nextDouble();
SI[5].setmathematicsscore(temp1);
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[5].getstunumber());
System.out.println(" 学生姓名:"+SI[5].getname());
System.out.println(" 高等数学成绩 :"+SI[5].getmathematicsscore());
System.out.println(" 请输入大学英语成绩:");
System.out.println("********************************************************");
double temp2=te.nextDouble();
SI[5].setenglishscore(temp2);
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[5].getstunumber());
System.out.println(" 学生姓名:"+SI[5].getname());
System.out.println(" 高等数学成绩 :"+SI[5].getmathematicsscore());
System.out.println(" 大学英语成绩:"+SI[5].getenglishscore());
System.out.println(" 请输入计算机网络成绩:");
System.out.println("********************************************************");
double temp3=te.nextDouble();
SI[5].setnetworkscore(temp3);
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[5].getstunumber());
System.out.println(" 学生姓名:"+SI[5].getname());
System.out.println(" 高等数学成绩 :"+SI[5].getmathematicsscore());
System.out.println(" 大学英语成绩:"+SI[5].getenglishscore());
System.out.println(" 计算机网络成绩:"+SI[5].getnetworkscore());
System.out.println(" 请输入数据库成绩:");
System.out.println("********************************************************");
double temp4=te.nextDouble();
SI[5].setdatabasescore(temp4);
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[5].getstunumber());
System.out.println(" 学生姓名:"+SI[5].getname());
System.out.println(" 高等数学成绩 :"+SI[5].getmathematicsscore());
System.out.println(" 大学英语成绩:"+SI[5].getenglishscore());
System.out.println(" 计算机网络成绩:"+SI[5].getnetworkscore());
System.out.println(" 数据库成绩:"+SI[5].getdatabasescore());
System.out.println(" 请输入软件工程成绩:");
System.out.println("********************************************************");
double temp5=te.nextDouble();
SI[5].setsoftwarescore(temp5);
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[5].getstunumber());
System.out.println(" 学生姓名:"+SI[5].getname());
System.out.println(" 高等数学成绩 :"+SI[5].getmathematicsscore());
System.out.println(" 大学英语成绩:"+SI[5].getenglishscore());
System.out.println(" 计算机网络成绩:"+SI[5].getnetworkscore());
System.out.println(" 数据库成绩:"+SI[5].getdatabasescore());
System.out.println(" 软件工程成绩:"+SI[5].getsoftwarescore());
System.out.println(" 该学生生成绩已录入完毕,是否提交(Y/N)");
System.out.println("********************************************************");
}
public Boolean pandun1() //输入Y或N并返回Boolean值
{
String temp6=te.next();
if(temp6.equals("Y"))
{
SI[j]=SI[5];
return true;
}
else
{
return false;
}
}
public void modifyscore() //功能2:实现学生成绩的修改
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩修改界面");
System.out.println("********************************************************");
System.out.println(" 请输入考生学号:");
System.out.println("********************************************************");
while(!getanswer()) //通过while 判断输入的学号是否存在
{
System.out.println("你输入的学号有误或不存在!");
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩修改界面");
System.out.println("********************************************************");
System.out.println(" 请输入考生学号:");
System.out.println("********************************************************");
}
System.out.println("********************************************************"); //输出学生的全部信息
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 1、高等数学成绩 :"+SI[j].getmathematicsscore());
System.out.println(" 2、大学英语成绩:"+SI[j].getenglishscore());
System.out.println(" 3、计算机网络成绩:"+SI[j].getnetworkscore());
System.out.println(" 4、数据库成绩:"+SI[j].getdatabasescore());
System.out.println(" 5、软件工程成绩:"+SI[j].getsoftwarescore());
System.out.println("********************************************************");
modifyspecialscore(); //修改成绩
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[6].getstunumber());
System.out.println(" 学生姓名:"+SI[6].getname());
System.out.println(" 1、高等数学成绩 :"+SI[6].getmathematicsscore());
System.out.println(" 2、大学英语成绩:"+SI[6].getenglishscore());
System.out.println(" 3、计算机网络成绩:"+SI[6].getnetworkscore());
System.out.println(" 4、数据库成绩:"+SI[6].getdatabasescore());
System.out.println(" 5、软件工程成绩:"+SI[6].getsoftwarescore());
System.out.println(" 该学生生成绩已录入完毕,是否提交(Y/N)");
System.out.println("********************************************************");
while(!pandun2())
{
modifyscore() ;
}
meau();
}
public void modifyspecialscore() //修改选定的成绩
{
SI[6]=new ScoreInformation(" "," ",0,0,0,0,0);
SI[6]=SI[j];
System.out.println("请输入你要修改的成绩对应的数字选项:");
int temp7=te.nextInt();
if(temp7==1)
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 请输入修改后高等数学成绩 :");
System.out.println("********************************************************");
double index1=te.nextDouble();
SI[6].setmathematicsscore(index1);
}
else if(temp7==2)
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("*******************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 请输入修改后大学英语成绩 :");
System.out.println("********************************************************");
double index2=te.nextDouble();
SI[6].setenglishscore(index2);
}
else if(temp7==3)
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("*******************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 请输入修改后计算机网络成绩 :");
System.out.println("********************************************************");
double index3=te.nextDouble();
SI[6].setnetworkscore(index3);
}
else if(temp7==4)
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("*******************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 请输入修改后数据库成绩 :");
System.out.println("********************************************************");
double index4=te.nextDouble();
SI[6].setdatabasescore(index4);
}
else if(temp7==5)
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("*******************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 请输入修改后软件工程成绩 :");
System.out.println("********************************************************");
double index5=te.nextDouble();
SI[6].setsoftwarescore(index5);
}
}
public Boolean pandun2() //输入Y或N并返回Boolean值
{
String temp8=te.next();
if(temp8.equals("Y"))
{
SI[j]=SI[6];
return true;
}
else
{
return false;
}
}
public void calulatescorepoint() //功能3:计算学生考试成绩对应的绩点
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t学生考试成绩绩点计算界面");
System.out.println("********************************************************");
System.out.println(" 请输入考生学号:");
System.out.println("********************************************************");
while(!getanswer())
{
System.out.println("你输入的学号有误或不存在!");
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t考生成绩录入");
System.out.println("********************************************************");
System.out.println(" 请输入考生学号:");
System.out.println("********************************************************");
}
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t学生成绩绩点计算界面");
System.out.println("********************************************************");
System.out.println(" 学生学号:"+SI[j].getstunumber());
System.out.println(" 学生姓名:"+SI[j].getname());
System.out.println(" 1、高等数学成绩 :"+SI[j].getmathematicsscore());
System.out.println(" 2、大学英语成绩:"+SI[j].getenglishscore());
System.out.println(" 3、计算机网络成绩:"+SI[j].getnetworkscore());
System.out.println(" 4、数据库成绩:"+SI[j].getdatabasescore());
System.out.println(" 5、软件工程成绩:"+SI[j].getsoftwarescore());
concullate();
System.out.println(" 是否返回主界面(Y/N)");
System.out.println("********************************************************");
pandun3();
}
public void concullate() //判断学生绩点是否满足毕业要求
{ double sum=0;
sum+=scorepoint(SI[j].getmathematicsscore())*5.0;
sum+=scorepoint(SI[j].getenglishscore())*3.0;
sum+=scorepoint(SI[j].getnetworkscore())*4.0;
sum+=scorepoint(SI[j].getdatabasescore())*3.0;
sum+=scorepoint(SI[j].getsoftwarescore())*4.0;
sum=sum/19;
String result=String.format("%.2f", sum);
System.out.println(" 你的平均学分绩点为:"+result);
if(sum>=2.0)
System.out.println(" 提示信息:你的学分绩点已达到毕业要求!");
else
System.out.println(" 提示信息:你的学分绩点不满足毕业要求!");
}
public double scorepoint(double sdc) //返回学生成绩对应的绩点
{
double index0=0;
if(sdc<60)
{
index0=0;
}
else if(sdc>=60&&sdc<=63.9)
{
index0=1.0;
}
else if(sdc>=64&&sdc<=65.9)
{
index0=1.5;
}
else if(sdc>=66&&sdc<=67.9)
{
index0=1.7;
}
else if(sdc>=68&&sdc<=71.9)
{
index0=2.0;
}
else if(sdc>=72&&sdc<=74.9)
{
index0=2.3;
}
else if(sdc>=75&&sdc<=77.9)
{
index0=2.7;
}
else if(sdc>=78&&sdc<=81.9)
{
index0=3.0;
}
else if(sdc>=82&&sdc<=84.9)
{
index0=3.3;
}
else if(sdc>=85&&sdc<=88.9)
{
index0=3.7;
}
else
index0=4.0;
return index0;
}
public void pandun3() //输入Y或N后进行相应的操作
{
String temp9=te.next();
if(temp9.equals("Y"))
{
meau();
}
else;
}
}

主函数

 package adc;
import java.util.*;
public class Text { public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
ScoreMangerment SM=new ScoreMangerment();
SM.meau(); //显示系统主界面
while(true)
{
int a=input.nextInt();
if(a==1)
{
SM.scorerecord(); //调用成绩录入函数 }
else if(a==2)
{
SM.modifyscore(); //调用成绩修改函数
}
else if(a==3)
{
SM.calulatescorepoint(); //调用计算学生绩点函数
}
else if(a==4) //退出系统
{
System.out.println("********************************************************");
System.out.println(" \t石家庄铁道大学软件工程系学籍管理2019版");
System.out.println(" \t制作人:王兵兵");
System.out.println("********************************************************");
break;
}
else //防止输入的选项不存在
{
System.out.println("该选项不存在!");
SM.meau();
}
}
input.close();
} }

心得体会:在写复杂且代码量庞大的程序时,一定要保证自己的逻辑思维清楚,一旦混乱,就会条理不清,调试寻找代码错误就会花费很长时间,所以逻辑思维很重要。

再者自己要保持良好的心态,一定要把题读懂读透,不要看一遍题后就立即开始做,先构造下自己的思路和框架。

最后就是基本功不扎实:对键盘不熟悉,敲代码的速度过慢以及准确率低,日后要多加练习。

java课堂测试样卷-----简易学籍管理系统的更多相关文章

  1. Java课堂测试--实现ATM的基本操作体会

    9月20的周四的Java课堂第一节课上就是有关于实现ATM的考试内容,在实现的过程中我了解到自己本身还是有很多的不足之处,例如在实现工程方面的相似性上面还有些许就的欠缺,再者就是回宿舍拿电源的原因导致 ...

  2. java课堂测试

       package 作业2; //信1805-1 杨一帆 20183608 public class ScoreInformation1 { private String stunumber; pr ...

  3. java课堂测试2(两种方式)

    实验源代码 这是不使用数组形式的源代码 /* 2017/10/10 王翌淞 课堂测试2 */import java.util.Scanner; public class Number { public ...

  4. Java 石家庄铁道大学软件工程系 学生学籍管理系统 2019 版

    本系统的作用是简单实现一些学生成绩管理操作:录入,修改,绩点计算,以及系统退出等. 首先建一个主函数实现界面的实现,然后建一个数据类用来定义存放数据.之后建立一个工具类,用来实现所有要进行的操作.首先 ...

  5. Java假期样卷 简易通讯录

    score.java package score; public class score { String name; String num; int age; boolean sex; double ...

  6. JAVA 课堂测试

    package ACC; /*信1705-2班 * 20173623 * 赵墨涵 */ public class Account { String accountID; String accountn ...

  7. Java课堂测试01及感想

    上周进行了Java的开学第一次测验,按要求做一个模拟ATM机功能的程序,实现存取款.转账汇款.修改密码.查询余额的操作.这次测验和假期的试题最大的不同还是把数组存储改成的文件存储,在听到老师说要用文件 ...

  8. java课堂测试—根据模板完成一个简单的技术需求征集系统

    课堂上老师发布了一个页面模板要求让我们实现一个系统的功能,模仿以后后端的简单工作情况. 然后在这个模板的基础上,提供了一个注册的网页模板,接着点击注册的按钮,发现register里面调用了zhu/zh ...

  9. Java课堂测试——一维数组

    题目: 一个典型的流程是: 2. 用户这时候有两个选择2.1  按 单步执行 键, 在 GUI 看到你的程序是如何一步一步算出目前最大子数组的范围,当前计算到的临时子数组是在哪里,等等. 最好用不同的 ...

随机推荐

  1. Java泛型使用的简单介绍

    目录 一. 泛型是什么 二. 使用泛型有什么好处 三. 泛型类 四. 泛型接口 五. 泛型方法 六. 限定类型变量 七. 泛型通配符 7.1 上界通配符 7.2 下界通配符 7.3 无限定通配符 八. ...

  2. MVC+EF Core 完整教程20--tag helper详解

    之前我们有一篇:“动态生成多级菜单”,对使用Html Helper做了详细讲述,并且自定义了一个菜单的 Html Helper: https://www.cnblogs.com/miro/p/5541 ...

  3. EVE-NG入门篇

    目录 一.EVE-NG配置要求 二.EVE-NG 安装 三.基于OVA的安装步骤 四.导入设备介绍 五.启动设备 六.与secure CRT关联 七.常见问题 一.EVE-NG配置要求 1.最低配置 ...

  4. 从 Python 之父的对话聊起,关于知识产权、知识共享与文章翻译

    一.缘起 前不久,我在翻译 Guido van Rossum(Python之父)的文章时,给他留言,申请非商业用途的翻译授权. 过程中起了点小误会,略去不表,最终的结果是:他的文章以CC BY-NC- ...

  5. python学习之路(1)---编程语言,变量

    编程语言的类型分为三大类:1.机器语言:01010的二进制语言,执行速度快,开发效率低2.汇编语言:把0101转换成我们可以看懂的字母,执行速度快,开发效率低3.高级语言 : 编译型语言:把源代码编程 ...

  6. springboot的异步调用

    package com.handsight.platform.fras.aapp; import java.util.Locale; import org.slf4j.Logger; import o ...

  7. git之旅,畅游git的世界

    今天小铭酱带大家探索一下git的奥秘! 1.初步探索 首先我在一个空的文件夹新建了一个名叫hello.html文件,文件内容只有一句话“hello git”.我们先引入git,看看git能为我们它能干 ...

  8. 分享:个人APP(非企业资质)的微信登录方案

    目前微信开放平台个人主体类APP不支持开通微信登录,那么个人开发者如何解决微信登录的问题呢?目前有一种替代方案是用微信小程序作为媒介来达到微信登录的目的. 微信小程序的登录无需企业资质,同时登录后返回 ...

  9. HandlerMethodArgumentResolver(一):Controller方法入参自动封装器【享学Spring MVC】

    每篇一句 你的工作效率高,老板会认为你强度不够.你代码bug多,各种生产环境救火,老板会觉得你是团队的核心成员. 前言 在享受Spring MVC带给你便捷的时候,你是否曾经这样疑问过:Control ...

  10. Java并发编程知识点总结Volatile、Synchronized、Lock实现原理

    Volatile关键字及其实现原理 在多线程并发编程中,Volatile可以理解为轻量级的Synchronized,用volatile关键字声明的变量,叫做共享变量,其保证了变量的“可见性”以及“有序 ...