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

本系统的作用是简单实现一些学生成绩管理操作:录入,修改,绩点计算,以及系统退出等。

首先建一个主函数实现界面的实现,然后建一个数据类用来定义存放数据。之后建立一个工具类,用来实现所有要进行的操作。首先实例化数据类,给他开辟一个可存放五组数据的数组空间,之后进行数据类的构造,然后调用赋值函数实现初始数据的存入,之后开始创建录入函数,尤其是录入界面的实现,每输一个数据进行一次界面的更新。然后先将录入的数据用新定义的变量来存取,之后输入完全后当输入"Y”时,将数据存放在数组中,输入“N”则返回主界面。之后修改函数先将录入完成界面进行输出,然后用switch函数实现选择修改的数据,然后每次修改一个数据后输入YN来判定,是Y的话存入,N的话返回。最后成绩绩点定义一个函数实现绩点的计算,然后输出时调用该函数进行输出。之后进行平均绩点的计算与输出,然后用if语句判断平均绩点的大小进行对应的输出。

具体实现代码如下:

//20183714 1805-2 董维学
package text;

import java.util.Scanner;

public class jiemian {

public static void main(String[] args) {
tools tool=new tools();
tool.chushi();
A:while(true)//循环输出界面,并使退出界面成为可行。
{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("**********************************************************");

Scanner scanner =new Scanner(System.in);
switch(scanner.nextInt()) {
case 1:
System.out.println("你选择了学生考试成绩录入;");
tool.luru();
break;
case 2:
System.out.println("你选择了 学生考试成绩修改;");
tool.update();
break;
case 3:
System.out.println("你选择了计算学生成绩绩点;");
tool.jidian();
break;
case 4:
System.out.println("***********************************************************");
System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 制作人:董维学");
System.out.println("***********************************************************");
break A;
default:
System.out.println("输入错误请重新输入");
break ;
}
}
}
}

package text;

public class ScoreInformation {
private String stunumber;
private String name;
private double mathmaticsscore;
private double englishiscore;
private double networkscore;
private double databasescore;
private double softscore;
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 getMathmaticsscore() {
return mathmaticsscore;
}
public void setMathmaticsscore(double mathmaticsscore) {
this.mathmaticsscore = mathmaticsscore;
}
public double getEnglishiscore() {
return englishiscore;
}
public void setEnglishiscore(double englishiscore) {
this.englishiscore = englishiscore;
}
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 getSoftscore() {
return softscore;
}
public void setSoftscore(double softscore) {
this.softscore = softscore;
}
public void fuzhi(String stunumber,String name,double mathmaticsscore,double englishiscore,double networkscore,double databasescore,double softscore)
{
this.stunumber = stunumber;
this.name = name;
this.mathmaticsscore = mathmaticsscore;
this.englishiscore = englishiscore;
this.networkscore = networkscore;
this.databasescore = databasescore;
this.softscore = softscore;
}//进行数据的赋值。
}

package text;

import java.util.Scanner;
public class tools {
ScoreInformation[] sco =new ScoreInformation[5];
Scanner scanner =new Scanner(System.in);
public void gouzao()
{
for(int i=0;i<5;i++)
sco[i]=new ScoreInformation();
}
public void chushi()//初始输入五个学生的学号姓名。
{
gouzao();
String a1,a2,a3,a4,a5;
String b1,b2,b3,b4,b5;
a1="20183714";
a2="65164651";
a3="31654313";
a4="16546131";
a5="13584135";
b1="董维学";
b2="小明";
b3="小红";
b4="小李";
b5="小刚";
sco[0].fuzhi(a1, b1, 0, 0, 0, 0, 0);
sco[1].fuzhi(a2, b2, 0, 0, 0, 0, 0);
sco[2].fuzhi(a3, b3, 0, 0, 0, 0, 0);
sco[3].fuzhi(a4, b4, 0, 0, 0, 0, 0);
sco[4].fuzhi(a5, b5, 0, 0, 0, 0, 0);
}
public void luru()//学生信息的录入
{

System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println("请输入学生学号:");
System.out.println("***********************************************************");
String num=scanner.next();
for(int j=0;j<=5;j++)
{
if(j<5)
{if(num.equals(sco[j].getStunumber()))
{ System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+num);
System.out.println(" 学生姓名:"+sco[j].getName());
System.out.println(" 请输入高等数学成绩: ");
System.out.println("***********************************************************");
double g=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println(" 学生学号:"+num);
System.out.println(" 学生姓名:"+sco[j].getName());
System.out.println(" 高等数学成绩"+g);
System.out.println(" 请输入大学英语成绩: ");
System.out.println("***********************************************************");
double y=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+num);
System.out.println(" 学生姓名:"+sco[j].getName());
System.out.println(" 高等数学成绩:"+g);
System.out.println(" 大学英语成绩:"+y);
System.out.println(" 请输入计算机网络成绩: ");
System.out.println("***********************************************************");
double w=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+num);
System.out.println(" 学生姓名:"+sco[j].getName());
System.out.println(" 高等数学成绩:"+g);
System.out.println(" 大学英语成绩:"+y);
System.out.println(" 计算机网络成绩:"+w);
System.out.println(" 请输入数据库成绩: ");
System.out.println("***********************************************************");
double s=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号;"+num);
System.out.println(" 学生姓名:"+sco[j].getName());
System.out.println(" 高等数学成绩:"+g);
System.out.println(" 大学英语成绩:"+y);
System.out.println(" 计算机网络成绩:"+w);
System.out.println(" 数据库成绩:"+s);
System.out.println(" 请输入软件工程成绩: ");
System.out.println("***********************************************************");
double r=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+num);
System.out.println(" 学生姓名:"+sco[j].getName());
System.out.println(" 高等数学成绩:"+g);
System.out.println(" 大学英语成绩:"+y);
System.out.println(" 计算机网络成绩:"+w);
System.out.println(" 数据库成绩:"+s);
System.out.println(" 软件工程成绩:"+r);
System.out.println("该学生成绩已录入完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String x=scanner.next();
if(x.equals("Y"))
{
sco[j].fuzhi(num, sco[j].getName(), g, y, w, s, r);
System.out.println("数据存入成功");
}
else if(x.equals("N"))
{ System.out.println("数据存入取消,请重新输入。");
luru();}
}
break;
}
if(j==5)
{
System.out.println("该学号不存在");
}
}
}

public void update()
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩修改");
System.out.println("***********************************************************");
System.out.println("请输入你要修改的学生学号:");
System.out.println("**********************************************************");
String n=scanner.next();
for(int i=0;i<6;i++)
{
if(i<5)
{ if(n.equals(sco[i].getStunumber()))
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学成绩:"+sco[i].getMathmaticsscore());
System.out.println(" 2、 大学英语成绩:"+sco[i].getEnglishiscore());
System.out.println(" 3、 计算机网络成绩:"+sco[i].getNetworkscore());
System.out.println(" 4、 数据库成绩:"+sco[i].getDatabasescore());
System.out.println(" 5、 软件工程成绩:"+sco[i].getSoftscore());
System.out.println("***********************************************************");
System.out.println("请输入你要修改的成绩:");
int q=scanner.nextInt();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
switch(q){
case 1:
System.out.println("请输入修改后的高数成绩");
double g=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学成绩:"+g);
System.out.println(" 2、 大学英语成绩:"+sco[i].getEnglishiscore());
System.out.println(" 3、 计算机网络成绩:"+sco[i].getNetworkscore());
System.out.println(" 4、 数据库成绩:"+sco[i].getDatabasescore());
System.out.println(" 5、 软件工程成绩:"+sco[i].getSoftscore());
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String x=scanner.next();
if(x.equals("Y"))
{ sco[i].setMathmaticsscore(g);
break;}
else if(x.equals("N"))
update();
break;
case 2:
System.out.println("请输入修改后的大学英语成绩");
double y=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学成绩:"+sco[i].getMathmaticsscore());
System.out.println(" 2、 大学英语成绩:"+y);
System.out.println(" 3、 计算机网络成绩:"+sco[i].getNetworkscore());
System.out.println(" 4、 数据库成绩:"+sco[i].getDatabasescore());
System.out.println(" 5、 软件工程成绩:"+sco[i].getSoftscore());
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String e=scanner.next();
if(e.equals("Y"))
sco[i].setEnglishiscore(y);
else if(e.equals("N"))
update();
break;
case 3:
System.out.println("请输入修改后的计算机网络成绩");
double w=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学成绩:"+sco[i].getMathmaticsscore());
System.out.println(" 2、 大学英语成绩:"+sco[i].getEnglishiscore());
System.out.println(" 3、 计算机网络成绩:"+w);
System.out.println(" 4、 数据库成绩:"+sco[i].getDatabasescore());
System.out.println(" 5、 软件工程成绩:"+sco[i].getSoftscore());
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String t=scanner.next();
if(t.equals("Y"))
sco[i].setNetworkscore(w);
else if(t.equals("N"))
update();
break;
case 4:
System.out.println("请输入修改后的数据库成绩");
double s=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学成绩:"+sco[i].getMathmaticsscore());
System.out.println(" 2、 大学英语成绩:"+sco[i].getEnglishiscore());
System.out.println(" 3、 计算机网络成绩:"+sco[i].getNetworkscore());
System.out.println(" 4、 数据库成绩:"+s);
System.out.println(" 5、 软件工程成绩:"+sco[i].getSoftscore());
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String u=scanner.next();
if(u.equals("Y"))
sco[i].setDatabasescore(s);
else if(u.equals("N"))
update();
break;
case 5:
System.out.println("请输入修改后的软件工程成绩");
double r=scanner.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学成绩:"+sco[i].getMathmaticsscore());
System.out.println(" 2、 大学英语成绩:"+sco[i].getEnglishiscore());
System.out.println(" 3、 计算机网络成绩:"+sco[i].getNetworkscore());
System.out.println(" 4、 数据库成绩:"+sco[i].getDatabasescore());
System.out.println(" 5、 软件工程成绩:"+r);
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String o=scanner.next();
if(o.equals("Y"))
sco[i].setSoftscore(r);
else if(o.equals("N"))
update();
break;
}
break;
}
if(i==5)
{ System.out.println("输入学号有误");
break;}
}
}
public double jdjs(double x)
{ double a = 0;
if(x>=90)
a= 4;
if(x>=85 &&x<=89.9)
a=3.7;
if(x>=82 &&x<=84.9)
a=3.3;
if(x>=78 &&x<=81.9)
a=3.0;
if(x>=75 &&x<=77.9)
a=2.7;
if(x>=72 &&x<=74.9)
a=2.3;
if(x>=68 &&x<=71.9)
a=2.0;
if(x>66 &&x<=67.9)
a=1.7;
if(x>64 &&x<=65.9)
a=1.5;
if(x>60 &&x<=63.9)
a=1.0;
else a=0;
return a;

}

public void jidian()
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试绩点统计");
System.out.println("***********************************************************");
System.out.println("请输入学生学号:");
System.out.println("**********************************************************");
String n=scanner.next();
for(int i=0;i<6;i++)
{
if(i<5)
{ if(n.equals(sco[i].getStunumber()))
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+sco[i].getStunumber());
System.out.println(" 学生姓名:"+sco[i].getName());
System.out.println(" 1、 高等数学绩点:"+jdjs(sco[i].getMathmaticsscore()));
System.out.println(" 2、 大学英语绩点:"+jdjs(sco[i].getEnglishiscore()));
System.out.println(" 3、 计算机网络绩点:"+jdjs(sco[i].getNetworkscore()));
System.out.println(" 4、 数据库绩点:"+jdjs(sco[i].getDatabasescore()));
System.out.println(" 5、 软件工程绩点:"+jdjs(sco[i].getSoftscore()));
double m=0;
m=jdjs(sco[i].getMathmaticsscore())*4+jdjs(sco[i].getEnglishiscore())*3+jdjs(sco[i].getNetworkscore())*4+jdjs(sco[i].getDatabasescore())*3+jdjs(sco[i].getSoftscore())*2;
double num=0;
num=m/16;
System.out.println(" 你的平均学分绩点为:"+String.format("%.2f", num));
if(num>=2)
System.out.println(" 你的学分绩点已达到毕业要求! ");
else
System.out.println(" 你的学分绩点不满足毕业要求! ");
System.out.println("是否返回主系统(Y/N)");
System.out.println("***********************************************************");
B:while(true)
{String o=scanner.next();
if(o.equals("Y"))
break B;
}
break;
}

if(i==5)
{System.out.println("未查到该学号!");
break;
}

}
}
}

原文地址:https://www.cnblogs.com/dwx8845/p/11507201.html