JAVA语言课堂测试01源代码(学生成绩管理系统)
Posted xiangyu721
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JAVA语言课堂测试01源代码(学生成绩管理系统)相关的知识,希望对你有一定的参考价值。
package 考试;
/*信1807-8
* 20183798
* 向瑜
*/
import java.util.Scanner;
//ScoreInformation 类
class ScoreInformation
private String stunumber;
private String name;
private double mathematicsscore;
private double englishscore;
private double networkscore;
private double databasescore;
private double softwarescore;
public ScoreInformation()
public 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 String getstunumber()
return stunumber;
public void setstunumber(String stunumber)
this.stunumber = stunumber;
public String getname()
return name;
public void setname(String name)
this.name = name;
public double getmathematicsscore()
return mathematicsscore;
public void setmathematicsscore(double mathematicsscore)
this.mathematicsscore = mathematicsscore;
public double getenglishscore()
return englishscore;
public void setenglishscore(double englishscore)
this.englishscore = englishscore;
public double getnetworkscore()
return networkscore;
public void setnetworkscore(double networkscore)
this.networkscore = networkscore;
public double getdatabasescore()
return databasescore;
public void setdatabasescore(double databasescore)
this.databasescore = databasescore;
public double getsoftwarescore()
return softwarescore;
public void setsoftwarescore(double softwarescore)
this.softwarescore = softwarescore;
class ScoreManagement
static Scanner scan = new Scanner(System.in);
static Scanner sc = new Scanner(System.in);
static boolean ll = false;
static boolean l = false;
static ScoreInformation[] a = new ScoreInformation[5];
static void dai()
a[0] = new ScoreInformation("11111111", "向", 0, 0, 0, 0, 0);
a[1] = new ScoreInformation("22222222", "瑜", 0, 0, 0, 0, 0);
a[2] = new ScoreInformation("33333333", "向瑜", 0, 0, 0, 0, 0);
a[3] = new ScoreInformation("44444444", "瑜向", 0, 0, 0, 0, 0);
a[4] = new ScoreInformation("55555555", "向瑜向", 0, 0, 0, 0, 0);
static int i;
public static void enter()
while (ll = true)
System.out.println("***********************************************");
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("请输入学生学号:");
System.out.println("***********************************************");
String n1 = sc.next();
for (i = 0; i < 5; i++)
if (n1.equals(a[i].getstunumber()))
l = true;
break;
if (l)
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("请输入高等数学成绩:");
a[i].setmathematicsscore(sc.nextDouble());
System.out.println("请输入大学英语成绩:");
a[i].setenglishscore(sc.nextDouble());
System.out.println("请输入计算机网络成绩:");
a[i].setnetworkscore(sc.nextDouble());
System.out.println("请输入数据库成绩:");
a[i].setdatabasescore(sc.nextDouble());
System.out.println("请输入软件工程成绩:");
a[i].setsoftwarescore(sc.nextDouble());
System.out.println("***********************************************");
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("大学英语成绩:" + a[i].getenglishscore());
System.out.println("计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("数据库成绩:" + a[i].getdatabasescore());
System.out.println("软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("该学生成绩录入完毕,是否提交(Y/N)");
System.out.println("***********************************************");
String n2 = sc.next();
if (n2.equals("Y"))
System.out.println("录入成功!!");
break;
else
a[i].setmathematicsscore(0);
a[i].setenglishscore(0);
a[i].setnetworkscore(0);
a[i].setdatabasescore(0);
a[i].setsoftwarescore(0);
System.out.println("录入失败!!");
ll = true;
else
System.out.println("该学号不存在!!!");
ll = true;
public static void updata()
double d1, d2, d3, d4, d5;
d1 = a[i].getmathematicsscore();
d2 = a[i].getenglishscore();
d3 = a[i].getnetworkscore();
d4 = a[i].getdatabasescore();
d5 = a[i].getsoftwarescore();
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("***********************************************");
System.out.println(" 请输入学生学号:");
String n3 = sc.next();
System.out.println("***********************************************");
for (i = 0; i < 5; i++)
if (n3.equals(a[i].getstunumber()))
l = true;
break;
if (l)
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("1、高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("2、大学英语成绩:" + a[i].getenglishscore());
System.out.println("3、计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("4、数据库成绩:" + a[i].getdatabasescore());
System.out.println("5、软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("***********************************************");
System.out.println("请选择需要修改的选项");
int k = sc.nextInt();
switch (k)
case 1:
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************");
System.out.println(" 学生学号:" + a[i].getstunumber());
System.out.println(" 学生姓名:" + a[i].getname());
System.out.println(" 请输入修改后的高等数学成绩:");
System.out.println("***********************************************");
a[i].setmathematicsscore(sc.nextDouble());
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("1、高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("2、大学英语成绩:" + a[i].getenglishscore());
System.out.println("3、计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("4、数据库成绩:" + a[i].getdatabasescore());
System.out.println("5、软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("***********************************************");
System.out.println(" 该学生成绩录入完毕,是否提交(Y/N)");
String n2 = sc.next();
if (n2.equals("Y"))
System.out.println("修改成功!!");
else
a[i].setmathematicsscore(d1);
a[i].setenglishscore(d2);
a[i].setnetworkscore(d3);
a[i].setdatabasescore(d4);
a[i].setsoftwarescore(d5);
System.out.println("录入失败!!");
break;
case 2:
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************");
System.out.println(" 学生学号:" + a[i].getstunumber());
System.out.println(" 学生姓名:" + a[i].getname());
System.out.println(" 请输入修改后的大学英语成绩:");
System.out.println("***********************************************");
a[i].setenglishscore(sc.nextDouble());
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("1、高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("2、大学英语成绩:" + a[i].getenglishscore());
System.out.println("3、计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("4、数据库成绩:" + a[i].getdatabasescore());
System.out.println("5、软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("***********************************************");
System.out.println(" 该学生成绩录入完毕,是否提交(Y/N)");
String n4 = sc.next();
if (n4.equals("Y"))
System.out.println("修改成功!!");
else
a[i].setmathematicsscore(d1);
a[i].setenglishscore(d2);
a[i].setnetworkscore(d3);
a[i].setdatabasescore(d4);
a[i].setsoftwarescore(d5);
System.out.println("录入失败!!");
break;
case 3:
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************");
System.out.println(" 学生学号:" + a[i].getstunumber());
System.out.println(" 学生姓名:" + a[i].getname());
System.out.println(" 请输入修改后的计算机网络成绩:");
System.out.println("***********************************************");
a[i].setnetworkscore(sc.nextDouble());
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("1、高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("2、大学英语成绩:" + a[i].getenglishscore());
System.out.println("3、计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("4、数据库成绩:" + a[i].getdatabasescore());
System.out.println("5、软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("***********************************************");
System.out.println(" 该学生成绩录入完毕,是否提交(Y/N)");
String n5 = sc.next();
if (n5.equals("Y"))
System.out.println("修改成功!!");
else
a[i].setmathematicsscore(d1);
a[i].setenglishscore(d2);
a[i].setnetworkscore(d3);
a[i].setdatabasescore(d4);
a[i].setsoftwarescore(d5);
System.out.println("录入失败!!");
break;
case 4:
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************");
System.out.println(" 学生学号:" + a[i].getstunumber());
System.out.println(" 学生姓名:" + a[i].getname());
System.out.println(" 请输入修改后的数据库成绩:");
System.out.println("***********************************************");
a[i].setdatabasescore(sc.nextDouble());
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("1、高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("2、大学英语成绩:" + a[i].getenglishscore());
System.out.println("3、计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("4、数据库成绩:" + a[i].getdatabasescore());
System.out.println("5、软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("***********************************************");
System.out.println(" 该学生成绩录入完毕,是否提交(Y/N)");
String n6 = sc.next();
if (n6.equals("Y"))
System.out.println("修改成功!!");
else
a[i].setmathematicsscore(d1);
a[i].setenglishscore(d2);
a[i].setnetworkscore(d3);
a[i].setdatabasescore(d4);
a[i].setsoftwarescore(d5);
System.out.println("录入失败!!");
break;
case 5:
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************");
System.out.println(" 学生学号:" + a[i].getstunumber());
System.out.println(" 学生姓名:" + a[i].getname());
System.out.println(" 请输入修改后的软件工程成绩:");
System.out.println("***********************************************");
a[i].setsoftwarescore(sc.nextDouble());
System.out.println("***********************************************");
System.out.println("石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("学生考试成绩录入");
System.out.println("***********************************************");
System.out.println("学生学号:" + a[i].getstunumber());
System.out.println("学生姓名:" + a[i].getname());
System.out.println("1、高等数学成绩:" + a[i].getmathematicsscore());
System.out.println("2、大学英语成绩:" + a[i].getenglishscore());
System.out.println("3、计算机网络成绩:" + a[i].getnetworkscore());
System.out.println("4、数据库成绩:" + a[i].getdatabasescore());
System.out.println("5、软件工程成绩:" + a[i].getsoftwarescore());
System.out.println("***********************************************");
System.out.println(" 该学生成绩录入完毕,是否提交(Y/N)");
String n7 = sc.next();
if (n7.equals("Y"))
System.out.println("修改成功!!");
else
a[i].setmathematicsscore(d1);
a[i].setenglishscore(d2);
a[i].setnetworkscore(d3);
a[i].setdatabasescore(d4);
a[i].setsoftwarescore(d5);
System.out.println("录入失败!!");
break;
public static void count()
while (ll = true)
double t1, t2, t3, t4, t5;
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩绩点计算界面 ");
System.out.println("***********************************************");
System.out.println(" 请输入学生学号:");
String n4 = sc.next();
System.out.println("***********************************************");
for (i = 0; i < 5; i++)
if (n4.equals(a[i].getstunumber()))
l = true;
break;
if (l)
if (a[i].getmathematicsscore() >= 90)
t1 = 4.0;
else if (a[i].getmathematicsscore() >= 85 && a[i].getmathematicsscore() <= 89.9)
t1 = 3.7;
else if (a[i].getmathematicsscore() >= 82 && a[i].getmathematicsscore() <= 84.9)
t1 = 3.3;
else if (a[i].getmathematicsscore() >= 78 && a[i].getmathematicsscore() <= 81.9)
t1 = 3.0;
else if (a[i].getmathematicsscore() >= 75 && a[i].getmathematicsscore() <= 77.9)
t1 = 2.7;
else if (a[i].getmathematicsscore() >= 72 && a[i].getmathematicsscore() <= 74.9)
t1 = 2.3;
else if (a[i].getmathematicsscore() >= 68 && a[i].getmathematicsscore() <= 71.9)
t1 = 2.0;
else if (a[i].getmathematicsscore() >= 66 && a[i].getmathematicsscore() <= 67.9)
t1 = 1.7;
else if (a[i].getmathematicsscore() >= 64 && a[i].getmathematicsscore() <= 65.9)
t1 = 1.5;
else if (a[i].getmathematicsscore() >= 60 && a[i].getmathematicsscore() <= 63.9)
t1 = 1.0;
else
t1 = 0;
if (a[i].getenglishscore() >= 90)
t2 = 4.0;
else if (a[i].getenglishscore() >= 85 && a[i].getenglishscore() <= 89.9)
t2 = 3.7;
else if (a[i].getenglishscore() >= 82 && a[i].getenglishscore() <= 84.9)
t2 = 3.3;
else if (a[i].getenglishscore() >= 78 && a[i].getenglishscore() <= 81.9)
t2 = 3.0;
else if (a[i].getenglishscore() >= 75 && a[i].getenglishscore() <= 77.9)
t2 = 2.7;
else if (a[i].getenglishscore() >= 72 && a[i].getenglishscore() <= 74.9)
t2 = 2.3;
else if (a[i].getenglishscore() >= 68 && a[i].getenglishscore() <= 71.9)
t2 = 2.0;
else if (a[i].getenglishscore() >= 66 && a[i].getenglishscore() <= 67.9)
t2 = 1.7;
else if (a[i].getenglishscore() >= 64 && a[i].getenglishscore() <= 65.9)
t2 = 1.5;
else if (a[i].getenglishscore() >= 60 && a[i].getenglishscore() <= 63.9)
t2 = 1.0;
else
t2 = 0;
if (a[i].getnetworkscore() >= 90)
t3 = 4.0;
else if (a[i].getnetworkscore() >= 85 && a[i].getnetworkscore() <= 89.9)
t3 = 3.7;
else if (a[i].getnetworkscore() >= 82 && a[i].getnetworkscore() <= 84.9)
t3 = 3.3;
else if (a[i].getnetworkscore() >= 78 && a[i].getnetworkscore() <= 81.9)
t3 = 3.0;
else if (a[i].getnetworkscore() >= 75 && a[i].getnetworkscore() <= 77.9)
t3 = 2.7;
else if (a[i].getnetworkscore() >= 72 && a[i].getnetworkscore() <= 74.9)
t3 = 2.3;
else if (a[i].getnetworkscore() >= 68 && a[i].getnetworkscore() <= 71.9)
t3 = 2.0;
else if (a[i].getnetworkscore() >= 66 && a[i].getnetworkscore() <= 67.9)
t3 = 1.7;
else if (a[i].getnetworkscore() >= 64 && a[i].getnetworkscore() <= 65.9)
t3 = 1.5;
else if (a[i].getnetworkscore() >= 60 && a[i].getnetworkscore() <= 63.9)
t3 = 1.0;
else
t3 = 0;
if (a[i].getdatabasescore() >= 90)
t4 = 4.0;
else if (a[i].getdatabasescore() >= 85 && a[i].getdatabasescore() <= 89.9)
t4 = 3.7;
else if (a[i].getdatabasescore() >= 82 && a[i].getdatabasescore() <= 84.9)
t4 = 3.3;
else if (a[i].getdatabasescore() >= 78 && a[i].getdatabasescore() <= 81.9)
t4 = 3.0;
else if (a[i].getdatabasescore() >= 75 && a[i].getdatabasescore() <= 77.9)
t4 = 2.7;
else if (a[i].getdatabasescore() >= 72 && a[i].getdatabasescore() <= 74.9)
t4 = 2.3;
else if (a[i].getdatabasescore() >= 68 && a[i].getdatabasescore() <= 71.9)
t4 = 2.0;
else if (a[i].getdatabasescore() >= 66 && a[i].getdatabasescore() <= 67.9)
t4 = 1.7;
else if (a[i].getdatabasescore() >= 64 && a[i].getdatabasescore() <= 65.9)
t4 = 1.5;
else if (a[i].getdatabasescore() >= 60 && a[i].getdatabasescore() <= 63.9)
t4 = 1.0;
else
t4 = 0;
if (a[i].getnetworkscore() >= 90)
t5 = 4.0;
else if (a[i].getnetworkscore() >= 85 && a[i].getnetworkscore() <= 89.9)
t5 = 3.7;
else if (a[i].getnetworkscore() >= 82 && a[i].getnetworkscore() <= 84.9)
t5 = 3.3;
else if (a[i].getnetworkscore() >= 78 && a[i].getnetworkscore() <= 81.9)
t5 = 3.0;
else if (a[i].getnetworkscore() >= 75 && a[i].getnetworkscore() <= 77.9)
t5 = 2.7;
else if (a[i].getnetworkscore() >= 72 && a[i].getnetworkscore() <= 74.9)
t5 = 2.3;
else if (a[i].getnetworkscore() >= 68 & a[i].getnetworkscore() <= 71.9)
t5 = 2.0;
else if (a[i].getnetworkscore() >= 66 && a[i].getnetworkscore() <= 67.9)
t5 = 1.7;
else if (a[i].getnetworkscore() >= 64 && a[i].getnetworkscore() <= 65.9)
t5 = 1.5;
else if (a[i].getnetworkscore() >= 60 && a[i].getnetworkscore() <= 63.9)
t5 = 1.0;
else
t5 = 0;
double tt, ttt;
tt = (t1 * 4 + t2 * 3 + t3 * 4 + t4 * 3 + t5 * 2) / 16;
ttt = (double) Math.round(tt * 100) / 100;
System.out.println("***********************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************");
System.out.println(" 学生学号:" + a[i].getstunumber());
System.out.println(" 学生姓名:" + a[i].getname());
System.out.println(" 高等数学绩点:" + t1);
System.out.println(" 高等数学绩点:" + t2);
System.out.println(" 计算机网络绩点:" + t3);
System.out.println(" 数据库绩点:" + t4);
System.out.println(" 软件工程绩点:" + t5);
System.out.println(" 你的平均学分绩点:" + ttt);
if (tt >= 2)
System.out.println(" 你的学分绩点达到毕业水平");
else
System.out.println(" 你的学分绩点没有达到毕业水平");
System.out.println("***********************************************");
String n6;
n6 = sc.next();
if (n6.equals("N"))
ll = true;
else
break;
public static void quit()
System.out.println("***********************************************************");
System.out.println("谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版"); System.out.println("***********************************************************");
public static void main(String[] args)
dai();
int p = 0;
while (p != 4)
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学软件工程系");
System.out.println("学生学籍管理系统 2019 版");
System.out.println("***********************************************************");
System.out.println("1、 学生考试成绩录入");
System.out.println("2、 学生考试成绩修改");
System.out.println("3、 计算学生成绩绩点");
System.out.println("4、退出学籍管理系统");
System.out.println("***********************************************************");
p = scan.nextInt();
switch (p)
case 1:
enter();
break;
case 2:
updata();
break;
case 3:
count();
break;
case 4:
quit();
break;
default:
System.out.println("输入错误请重新输入!");
以上是关于JAVA语言课堂测试01源代码(学生成绩管理系统)的主要内容,如果未能解决你的问题,请参考以下文章
JAVA:编写一个学生成绩管理系统。学生的属性包括学号、姓名、年龄等。