学生信息管理系统
package 测试1;
import java.util.Scanner;
class ScoreInfomation
{
private String stunumber;
private double mathematicsscore;
private double englishiscore;
private double networkscore;
private double databasescore;
private double softwarescore;
private String name;
ScoreInfomation(String a,String b,double c,double d,double e,double f,double g)
{
name=a;
stunumber=b;
mathematicsscore=c;
englishiscore=d;
networkscore=e;
databasescore=f;
softwarescore=g;
};
ScoreInfomation(){};
static Scanner input=new Scanner(System.in);
public void setstunumber()
{ stunumber=input.next();};
public void setsoftwarescore()
{ softwarescore=input.nextDouble();};
public void setdatabasescore()
{ databasescore=input.nextDouble();};
public void setnetworkscore()
{ double a=input.nextDouble();
networkscore=a;}
public void setname()
{ name=input.next();};
public void setenglishiscore()
{ englishiscore=input.nextDouble();};
public void setmathematicsscore()
{ mathematicsscore=input.nextDouble();};
public String getstunumber()
{return stunumber;}
public double getmathematicsscore()
{return mathematicsscore;}
public double getenglishiscore()
{return englishiscore;}
public double getnetworkscore()
{return networkscore;}
public double getdatabasescore()
{return databasescore;}
public double getsoftwarescore()
{return softwarescore;}
public String getname()
{return name;}
}
package 测试1;
import java.util.Scanner;
public class ScoreManagement
{
static int g=0;
double h=0;
static Scanner input=new Scanner(System.in);
static ScoreInfomation a[]=new ScoreInfomation [100];
static int Q=0;
ScoreManagement()
{
if(g==0) {
a[0]=new ScoreInfomation("张宏伟","20183700",0,0,0,0,0);
a[1]=new ScoreInfomation("刘宏伟","20183701",0,0,0,0,0);
a[2]=new ScoreInfomation("王宏伟","20183702",0,0,0,0,0);
a[3]=new ScoreInfomation("李宏伟","20183703",0,0,0,0,0);
a[4]=new ScoreInfomation("孙宏伟","20183704",0,0,0,0,0);
a[5]=new ScoreInfomation("赵宏伟","20183705",0,0,0,0,0);
}
g++;
}
static int t=0;
void ingaoshu()
{
System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("*****************************************************");
System.out.println(" 请输入学生学号:");
System.out.println(" 高数成绩:");
a[t].setmathematicsscore();
System.out.println(" 英语成绩:");
a[t].setenglishiscore();
System.out.println(" 计算机网络成绩:");
a[t].setnetworkscore();
System.out.println(" 数据库成绩:");
a[t].setsoftwarescore();
System.out.println(" 软件工程成绩:");
a[t].setdatabasescore();
System.out.println(" 成绩已录入完毕,是否提交(Y/N):");
String H=input.next();
String Y=a[t].getstunumber();
if(H.equals("Y"))
{
ScoreManagement E = new ScoreManagement();
E.jiemian();
}
else
{
ScoreManagement E = new ScoreManagement();
E.inchengji();
}
System.out.println("*****************************************************");
}
void jiemian()
{
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("**********************************************");
ScoreManagement E = new ScoreManagement();
E.usejiemian();
}
void usejiemian()
{
ScoreManagement B = new ScoreManagement();
Q=input.nextInt();
if(Q!=1&&Q!=2&&Q!=3&&Q!=4)
{
System.out.println("该选项不存在");
B.jiemian();
}
switch(Q)
{
case 1:
{
B.inchengji();
break;
}
case 2:
{
B.xiugai();
break;
}
case 3:
{
B.jiyemian();
break;
}
case 4:
{
B.tui();
break;
}
}
}
void tui()
{
System.out.println("*************************************************************");
System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 制作人:张宏伟");
System.out.println("*************************************************************");
}
void xiugai()
{
t=0;
@SuppressWarnings("unused")
ScoreInfomation M=new ScoreInfomation();
ScoreManagement E = new ScoreManagement();
System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改");
System.out.println("*****************************************************");
System.out.println(" 学生学号:");
String v=input.next();
System.out.println("*****************************************************");
while(t<7) {
String n=a[t].getstunumber();
if(n.equals(v))
{
System.out.print(" 1. 高数成绩:");
System.out.println(a[t].getmathematicsscore());
System.out.print(" 2. 英语成绩:");
System.out.println( a[t].getenglishiscore());
System.out.print(" 3.计算机成绩:");
System.out.println(a[t].getnetworkscore());
System.out.print(" 4.数据库成绩:");
System.out.println(a[t].getdatabasescore());
System.out.print(" 5.软件工程成绩:");
System.out.println(a[t].getsoftwarescore());
System.out.println("*****************************************************");
int K=input.nextInt();
switch(K)
{
case 1:{
System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("*****************************************************");
System.out.print(" 学生学号:");
System.out.println(a[t].getstunumber());
System.out.print(" 学生姓名:");
System.out.println(a[t].getname());
System.out.println("*****************************************************");
System.out.println("请输入修改后成绩");
a[t].setmathematicsscore();
E.queren();
break;
}
case 2:{
System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("*****************************************************");
System.out.print(" 学生学号:");
System.out.println(a[t].getstunumber());
System.out.print(" 学生姓名:");
System.out.println(a[t].getname());
System.out.println("*****************************************************");
System.out.println("请输入修改后成绩");
a[t].setenglishiscore();
E.queren();
break;
}
case 3:{System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("*****************************************************");
System.out.print(" 学生学号:");
System.out.println(a[t].getstunumber());
System.out.print(" 学生姓名:");
System.out.println(a[t].getname());
System.out.println("*****************************************************");
System.out.println("请输入修改后成绩");
a[t].setnetworkscore();
E.queren();
break;
}
case 4:{System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("*****************************************************");
System.out.print(" 学生学号:");
System.out.println(a[t].getstunumber());
System.out.print(" 学生姓名:");
System.out.println(a[t].getname());
System.out.println("*****************************************************");
System.out.println("请输入修改后成绩");
a[t].setdatabasescore();
E.queren();
break;
}
case 5:{System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("*****************************************************");
System.out.print(" 学生学号:");
System.out.println(a[t].getstunumber());
System.out.print(" 学生姓名:");
System.out.println(a[t].getname());
System.out.println("*****************************************************");
System.out.println("请输入修改后成绩");
a[t].setsoftwarescore();
E.queren();
break;
}
}
}
t++;}
while(t>1) {
String n=a[t].getstunumber();
if(!n.equals(v))
{
System.out.println(" 该学号不存在");
E.xiugai();
}
t--;}
}
void inchengji()
{
t=0;
ScoreManagement E = new ScoreManagement();
System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("*****************************************************");
System.out.println(" 请输入学生学号:");
System.out.println("*****************************************************");
String u=input.next();
while(t<7)
{
String v=a[t].getstunumber();
if(u.equals(v))
{
E.ingaoshu();
break;
}
t++;
}
while(t>1)
{String v=a[t].getstunumber();
if(!u.equals(v))
{
System.out.println(" 该学生成绩不存在");
E.inchengji();break;
}
t--;
}
}
void queren()
{
ScoreInfomation D=new ScoreInfomation();
System.out.println("*****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入");
System.out.println("*****************************************************");
System.out.println(" 学生学号:");
System.out.println(a[t].getstunumber());
System.out.print(" 高数成绩:");
System.out.println(a[t].getmathematicsscore());
System.out.print(" 英语成绩:");
System.out.println(a[t].getenglishiscore());
System.out.print(" 计算机网络成绩:");
System.out.println(a[t].getnetworkscore());
System.out.print(" 数据库成绩:");
System.out.println(a[t].getsoftwarescore());
System.out.print(" 软件工程成绩:");
System.out.println(a[t].getdatabasescore());
System.out.println(" 成绩已修改完毕,是否提交(Y/N):");
String H=input.next();
if(H.equals("Y"))
{
ScoreManagement F = new ScoreManagement();
F.jiemian();
}
else {
ScoreManagement F = new ScoreManagement();
F.inchengji();
}
System.out.println("*****************************************************");
}
void jiyemian()
{
t=0;
ScoreManagement E = new ScoreManagement();
System.out.println("******************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩绩点计算界面 ");
System.out.println("******************************************************");
System.out.println(" 请输入学生学号: ");
System.out.println("******************************************************");
String u=input.next();
while(t<7)
{
String v=a[t].getstunumber();
if(u.equals(v))
{
E.jidian();
break;
}
t++;
}
while(t>1)
{String v=a[t].getstunumber();
if(!u.equals(v))
{
System.out.println(" 该学号不存在");
E.jiyemian();
break;
}
t--;
}
}
void jidian()
{
ScoreManagement E = new ScoreManagement();
System.out.println("******************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩绩点计算界面 ");
System.out.println("******************************************************");
System.out.println(" 学生学号: ");
System.out.println(a[t].getstunumber());
System.out.println(" 学生姓名: ");
System.out.println(a[t].getname());
System.out.print(" 1.高数成绩绩点: ");
System.out.println(E.jisuan(a[t].getmathematicsscore()));
System.out.print(" 2.英语成绩绩点: ");
System.out.println(E.jisuan(a[t].getenglishiscore()));
System.out.print(" 3.计算机成绩绩点: ");
System.out.println(E.jisuan(a[t].getnetworkscore()));
System.out.print(" 4.数据库成绩绩点: ");
System.out.println(E.jisuan(a[t].getdatabasescore()));
System.out.print(" 5.软件工程成绩绩点: ");
System.out.println(E.jisuan(a[t].getsoftwarescore()));
System.out.print(" 你的平均学分绩点: ");
System.out.println(E.ping());
System.out.print(" 提示信息: ");
if(E.ping()>2)
{System.out.println(" 你的学分绩点已达到毕业要求 ");}
else
{
System.out.println(" 你的学分绩点不满足毕业要求 ");
}
System.out.println(" 是否返回系统主界面:(Y/N) ");
String H=input.next();
if(H.equals("Y"))
{
ScoreManagement F = new ScoreManagement();
F.jiemian();
}
else {
}
System.out.print("******************************************************");
}
double jisuan(double u)
{
if(u<60)
{
h=0;
}
else if(u<63.9)
{
h=1.0;
}
else if(u<65.9) {h=1.5;}
else if(u<67.9) {h=1.7;}
else if(u<71.9) {h=2.0;}
else if(u<74.9) {h=2.3;}
else if(u<77.9) {h=2.7;}
else if(u<81.9) {h=3.0;}
else if(u<84.9) {h=3.3;}
else if(u<89.9) {h=3.7;}
else {h=4.0;}
return h;
}
double ping()
{
ScoreManagement E = new ScoreManagement();
h=((E.jisuan(a[t].getmathematicsscore())*4)+(E.jisuan(a[t].getnetworkscore())*4)+(E.jisuan(a[t].getenglishiscore())*3)+(E.jisuan(a[t].getdatabasescore())*3)+(E.jisuan(a[t].getsoftwarescore())*2));
h=h/16;
Double get_double = Double.parseDouble(String.format("%.2f", h));
return get_double;
}
public static void main(String[] args)
{
int Q=0;
ScoreManagement A = new ScoreManagement();
A.jiemian();
A.usejiemian();
}
}
本次用java写出了学生成绩管理系统,可实现录入,修改成绩,计算学生绩点功能;将对应功能写为函数,通过对象实现循环调用,从而完成要求;

浙公网安备 33010602011771号