“石家庄铁道大学软件工程系学生学籍管理系统2019版”java小程序制作分享

首先附上完整代码:

import java.util.Scanner;

public class SocreInformation {
public SocreInformation(){};
public SocreInformation(String i1,String i2,double i3,double i4,double i5,double i6,double i7)
{stunumber=i1;
name=i2;
mathematicsscore=i3;
englishiscore=i4;
networkscore=i5;
databasescore=i6;
softwarescore=i7;
}
private String stunumber,name;
private double mathematicsscore,englishiscore,networkscore,databasescore,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 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 getSoftwarescore() {
return softwarescore;
}
public void setSoftwarescore(double softwarescore) {
this.softwarescore = softwarescore;
}


}/*学生成绩信息类*/

public class ScoreManagement {

static Scanner input=new Scanner(System.in);
private int i=0;
private int x;
SocreInformation [] stu=new SocreInformation[5];
public void rest() {
stu[0]=new SocreInformation("20183699","小明",90,84,88,93,85);
stu[1]=new SocreInformation("20183001","小A",89,93,92,82,80);
stu[2]=new SocreInformation("20183002","小B",90,83,67,78,87);
stu[3]=new SocreInformation("20183003","小C",78,85,90,78,84);
stu[4]=new SocreInformation("20183004","小D",88,86,85,98,90);}



public void show() {
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("****************************");
ch();
}
public void ch()
{
x=input.nextInt();
switch(x)
{case 1:inscore();break;
case 2:change();break;
case 3:point();break;
case 4:out();break;
default:System.out.println("输入信息有误!");show();break;

}

}
public void out() {
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 制作人:小明");

System.out.println("******************************************");
}
public void point()
{String s,s2;int c=0;double la=0;i=0;
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩绩点计算界面");
System.out.println("******************************************");
System.out.println(" 请输入学生学号:");
System.out.println("******************************************");
s=input.next();
for(i=0;i<5;i++)
{
if(s.equals(stu[i].getStunumber()))
{
c=1;break;

}}
if(c==0) {System.out.println("用户不存在!");point();}
double [] sc=new double[5];
double [] j=new double[5];
sc[0]=stu[i].getMathematicsscore();
sc[1]=stu[i].getEnglishiscore();
sc[2]=stu[i].getNetworkscore();
sc[3]=stu[i].getDatabasescore();
sc[4]=stu[i].getSoftwarescore();
for(int w=0;w<5;w++)
{
if(sc[w]>=90)j[w]=4.0;
if(sc[w]>=85&&sc[w]<90)j[w]=3.7;
if(sc[w]>=82&&sc[w]<85)j[w]=3.3;
if(sc[w]>=78&&sc[w]<82)j[w]=3.0;
if(sc[w]>=75&&sc[w]<78)j[w]=2.7;
if(sc[w]>=72&&sc[w]<75)j[w]=2.3;
if(sc[w]>=68&&sc[w]<72)j[w]=2.0;
if(sc[w]>=66&&sc[w]<68)j[w]=1.7;
if(sc[w]>=64&&sc[w]<66)j[w]=1.5;
if(sc[w]>=60&&sc[w]<64)j[w]=1.0;
if(sc[w]>=0&&sc[w]<60)j[w]=0;

}
j[0]=4*j[0];
j[1]=3*j[1];
j[2]=4*j[2];
j[3]=3*j[3];
j[4]=2*j[4];
for(int w=0;w<5;w++)
{
la+=j[w];
}
la/=5;
if(la>=2)s2="你的学分绩点已达到毕业要求!";
else s2="你的学分绩点不满足毕业要求!";
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩绩点:"+j[0]);
System.out.println(" 2、大学英语成绩绩点:"+j[1]);
System.out.println(" 3、计算机网络成绩绩点:"+j[2]);
System.out.println(" 4、数据库成绩绩点:"+j[3]);
System.out.println(" 5、软件工程绩点:"+j[4]);
System.out.println(" 你的平均学分绩点为:"+la);
System.out.println(" 提示信息:"+s2);
System.out.println(" 是否返回系统主界面:(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {show();}
else point();
}

public void change()
{
String s;int c=0;int w;double a;i=0;
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 请输入学生学号:");
System.out.println("******************************************");
s=input.next();
for(i=0;i<5;i++)
{
if(s.equals(stu[i].getStunumber()))
{
c=1;break;

}}
if(c==0) {System.out.println("用户不存在!");change();}
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩:"+stu[i].getMathematicsscore());
System.out.println(" 2、大学英语成绩:"+stu[i].getEnglishiscore());
System.out.println(" 3、计算机网络成绩:"+stu[i].getNetworkscore());
System.out.println(" 4、数据库成绩:"+stu[i].getDatabasescore());
System.out.println(" 5、软件工程:"+stu[i].getSoftwarescore());
System.out.println("******************************************");
w=input.nextInt();
switch(w)
{
case 1:
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 请输入修改后的高等数学成绩: ");
System.out.println("******************************************");
a=input.nextDouble();
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩:"+a);
System.out.println(" 2、大学英语成绩:"+stu[i].getEnglishiscore());
System.out.println(" 3、计算机网络成绩:"+stu[i].getNetworkscore());
System.out.println(" 4、数据库成绩:"+stu[i].getDatabasescore());
System.out.println(" 5、软件工程:"+stu[i].getSoftwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交?(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {stu[i].setMathematicsscore(a);show();}
else change();
break;/*高数*/
case 2:System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 请输入修改后的大学英语成绩: ");
System.out.println("******************************************");
a=input.nextDouble();
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩:"+stu[i].getMathematicsscore());
System.out.println(" 2、大学英语成绩:"+a);
System.out.println(" 3、计算机网络成绩:"+stu[i].getNetworkscore());
System.out.println(" 4、数据库成绩:"+stu[i].getDatabasescore());
System.out.println(" 5、软件工程:"+stu[i].getSoftwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交?(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {stu[i].setEnglishiscore(a);show();}
else change();
break;/*英语*/
case 3:
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 请输入修改后的计算机网络成绩: ");
System.out.println("******************************************");
a=input.nextDouble();
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩:"+stu[i].getMathematicsscore());
System.out.println(" 2、大学英语成绩:"+stu[i].getEnglishiscore());
System.out.println(" 3、计算机网络成绩:"+a);
System.out.println(" 4、数据库成绩:"+stu[i].getDatabasescore());
System.out.println(" 5、软件工程:"+stu[i].getSoftwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交?(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {stu[i].setNetworkscore(a);show();}
else change();
break;/*网络*/
case 4:
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 请输入修改后的数据库成绩: ");
System.out.println("******************************************");
a=input.nextDouble();
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩:"+stu[i].getMathematicsscore());
System.out.println(" 2、大学英语成绩:"+stu[i].getEnglishiscore());
System.out.println(" 3、计算机网络成绩:"+stu[i].getNetworkscore());
System.out.println(" 4、数据库成绩:"+a);
System.out.println(" 5、软件工程:"+stu[i].getSoftwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交?(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {stu[i].setNetworkscore(a);show();}
else change();
break;/*数据库*/
case 5:
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 请输入修改后的软件工程成绩: ");
System.out.println("******************************************");
a=input.nextDouble();
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 1、高等数学成绩:"+stu[i].getMathematicsscore());
System.out.println(" 2、大学英语成绩:"+stu[i].getEnglishiscore());
System.out.println(" 3、计算机网络成绩:"+stu[i].getNetworkscore());
System.out.println(" 4、数据库成绩:"+stu[i].getDatabasescore());
System.out.println(" 5、软件工程:"+a);
System.out.println(" 该学生成绩已修改完毕,是否提交?(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {stu[i].setSoftwarescore(a);show();}
else change();
break;
default:break;
}
}/*修改*/
public void inscore()
{ String s;double sm,se,sn,sd,ss;int c=0;
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 请输入学生学号:");
System.out.println("******************************************");
s=input.next();
for(i=0;i<5;i++)
{
if(s.equals(stu[i].getStunumber())) {c=1;break;}
}
if(c==0) {System.out.println("该学号不存在!");inscore();}
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 请输入高等数学成绩:");
System.out.println("******************************************");
sm=input.nextDouble();
/*高数*/
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 高等数学成绩:"+sm);
System.out.println(" 请输入大学英语成绩:");
System.out.println("******************************************");
se=input.nextDouble();
/*英语*/
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 高等数学成绩:"+sm);
System.out.println(" 大学英语成绩:"+se);
System.out.println(" 请输入计算机网络成绩:");
System.out.println("******************************************");
sn=input.nextDouble();
/*网络*/
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 高等数学成绩:"+sm);
System.out.println(" 大学英语成绩:"+se);
System.out.println(" 计算机网络成绩:"+sn);
System.out.println(" 请输入数据库成绩:");
System.out.println("******************************************");
sd=input.nextDouble();
/*数据库*/
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 高等数学成绩:"+sm);
System.out.println(" 大学英语成绩:"+se);
System.out.println(" 计算机网络成绩:"+sn);
System.out.println(" 数据库成绩:"+sd);
System.out.println(" 请输入软件工程:");
System.out.println("******************************************");
ss=input.nextDouble();
/*软工*/
System.out.println("******************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("******************************************");
System.out.println(" 学生学号:"+stu[i].getStunumber());
System.out.println(" 学生姓名:"+stu[i].getName());
System.out.println(" 高等数学成绩:"+sm);
System.out.println(" 大学英语成绩:"+se);
System.out.println(" 计算机网络成绩:"+sn);
System.out.println(" 数据库成绩:"+sd);
System.out.println(" 软件工程:"+ss);
System.out.println(" 该学生成绩已录入完毕,是否提交?(Y/N)");
System.out.println("******************************************");
s=input.next();
if(s.equals("Y")) {
stu[i].setMathematicsscore(sm);
stu[i].setEnglishiscore(se);
stu[i].setNetworkscore(sn);
stu[i].setSoftwarescore(ss);
stu[i].setDatabasescore(sd);
show();
}
else show();

}
}/*管理系统类*/

public class infor {

static Scanner input=new Scanner(System.in);
public static void main(String[] args) {
ScoreManagement x=new ScoreManagement();
x.rest();
x.show();

}

}/*main函数*/

首先学生信息类SocreInformation包含的几个数据成员分别是学生的个人信息和其成绩,并且都有着各自的set及get及函数,这为接下来的数据调用和修改做好了准备。

接下来是管理系统类ScoreManagement,它是这个程序的核心,首先定义了一个长度为5的学生类数组,并设置了rest()函数为学生类对象数据初始化;接下来是程序界面显示函数show(),他的作用就是主界面的显示,至于如何实现主界面上各个选项的功能,这就依赖于其调用的ch()函数了,ch()函数的作用就是获取用户对功能的选择并实现到相应功能的跳转;ch()函数含有swich结构,通过它可调用相应功能的函数。也就是说,该管理系统每一个功能都是由相应的函数实现,其功能及对应函数分别为

学生考试成绩录入—inscore();
学生考试成绩修改—change();
计算学生成绩绩点—point();
退出学籍管理系统—out();

成绩录入函数inscore()通过对输入的学生号对数据进行检索,找到符合的学生及对其进行成绩录入,录入的成绩暂时储存在其内部的变量中,当录入完毕用户确认提交后,才会利用学生类的set函数修改该学生的成绩,然后调用show()返回主界面。若用户否决提交,则调用show()函数返回主界面,学生的信息不会被修改。

成绩修改函数change()与录入函数大同小异,通过学号找到学生,选择要修改的成绩,在用户确认提交后才会利用set函数真正修改学生信息,然后调用show()返回主界面。否决提交则调用show()返回主界面。

绩点计算函数point(),先根据学号找到学生,因为要为各科目根据成绩所处区间进行绩点计算,因此我在这里定义了两个整型数组j[5]和w[5],用w[5]和get()函数来储存5科成绩,再根据绩点计算规则计算出相应绩点并存储在j[5],接下来的总绩点该怎么算就根据计算规则来就可以了,并在最后进行显示,并在最后调用show()返回主界面。

退出函数out(),进行显示一些自己定义的内容,之后不会调用show()函数,因此程序到此就会结束。

main()函数中,首先定义一个ScoreManagement 对象,之后掉用rest()函数对其进行初始化,再掉用show()函数,这样程序就可以运行了。

猜你喜欢

转载自www.cnblogs.com/liuleliu/p/11505426.html