一、实验要求
一、数据结构要求:(5 分)
package 学生成绩管理系统;
public class ScoreInformation
{
private String stunumber;//学号
public String get_stunumber()//读取学号
{
return this.stunumber;
}
public void set_stunumber(String stunumber)//设置学号
{
this.stunumber=stunumber;
}
private String name;//姓名
public String get_name()//读取姓名
{
return this.name;
}
public void set_name(String name)//设置姓名
{
this.name=name;
}
private double mathematicsscore;//高等数学成绩
public double get_mathematicsscore()//读取高等数学成绩
{
return this.mathematicsscore;
}
public void set_mathematicsscore(double mathematicsscore)//设置高等数学成绩
{
this.mathematicsscore=mathematicsscore;
}
private double englishiscore;//大学英语成绩
public double get_englishiscore()//读取大学英语成绩
{
return this.englishiscore;
}
public void set_englishiscore(double englishiscore)//设置大学英语成绩
{
this.englishiscore=englishiscore;
}
private double networkscore;//计算机网络成绩
public double get_networkscore()//读取计算机网络成绩
{
return this.networkscore;
}
public void set_networkscore(double networkscore)//设置计算机网络成绩
{
this.networkscore=networkscore;
}
private double databasescore;//数据库成绩
public double get_databasescore()//读取数据库成绩
{
return this.databasescore;
}
public void set_databasescore(double databasescore)//设置数据库成绩
{
this.databasescore=databasescore;
}
private double softwarescore;//软件工程成绩
public double get_softwarescore()//读取软件工程成绩
{
return this.softwarescore;
}
public void set_softwarescore(double softwarescore)//设置软件工程成绩
{
this.softwarescore=softwarescore;
}
ScoreInformation(String stunumber,String name,double mathematicsscore,double englishiscore,double networkscore,double databasescore,double softwarescore)//赋初值
{
this.stunumber=stunumber;
this.name=name;
this.mathematicsscore=mathematicsscore;
this.englishiscore=englishiscore;
this.networkscore=networkscore;
this.databasescore=databasescore;
this.softwarescore=softwarescore;
}
public static void main(String[] args)
{
}
}
package 学生成绩管理系统;
import java.util.Scanner;
public class ScoreManagement
{
public static void main(String[] args)
{
String ppp="Y";
Scanner in=new Scanner(System.in);
ScoreInformation[] data = new ScoreInformation[5];
data[0]=new ScoreInformation("20183621","程璞阳",0,0,0,0,0);
data[1]=new ScoreInformation("20183622","杨明睿",0,0,0,0,0);
data[2]=new ScoreInformation("20183623","张千龙",0,0,0,0,0);
data[3]=new ScoreInformation("20183635","邵文",0,0,0,0,0);
data[4]=new ScoreInformation("20183600","丁俊林",0,0,0,0,0);
for(int i=0;;i++)
{
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("***********************************************************");
int a=in.nextInt();
if(a<1||a>4)
{
System.out.print("该选项不存在。");
}
else
{
if(a==1)//学生考试成绩录入
{
for(int k=0;;k++)
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 请输入学生学号:(请输入八位学号)");
System.out.println("***********************************************************");
String b=in.next();
int w=-1;
for(int j=0;j<5;j++)
{
String c=data[j].get_stunumber();
if(b.equals(c))
{
w=j;
break;
}
}
if(w==-1)
{
System.out.println("该学号不存在。");
}
else
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 请输入高等数学成绩:");
System.out.println("***********************************************************");
double a1=in.nextDouble();
data[w].set_mathematicsscore(a1);
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 请输入大学英语成绩:");
System.out.println("***********************************************************");
double a2=in.nextDouble();
data[w].set_englishiscore(a2);
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 请输入计算机网络成绩:");
System.out.println("***********************************************************");
double a3=in.nextDouble();
data[w].set_networkscore(a3);
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 请输入数据库成绩:");
System.out.println("***********************************************************");
double a4=in.nextDouble();
data[w].set_databasescore(a4);
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 数据库成绩:"+data[w].get_databasescore());
System.out.println(" 请输入软件工程成绩:");
System.out.println("***********************************************************");
double a5=in.nextDouble();
data[w].set_softwarescore(a5);
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 数据库成绩:"+data[w].get_databasescore());
System.out.println(" 软件工程成绩:"+data[w].get_softwarescore());
System.out.println(" 该学生成绩已录入完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String a6=in.next();
if(ppp.equals(a6))
{
break;
}
else
{
data[w].set_mathematicsscore(0);
data[w].set_englishiscore(0);
data[w].set_networkscore(0);
data[w].set_databasescore(0);
data[w].set_softwarescore(0);
}
}
}
}
if(a==2)//学生考试成绩修改
{
for(int k=0;;k++)
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("***********************************************************");
System.out.println(" 请输入学生学号:(请输入八位学号)");
System.out.println("***********************************************************");
String b=in.next();
int w=-1;
for(int j=0;j<5;j++)
{
String c=data[j].get_stunumber();
if(b.equals(c))
{
w=j;
break;
}
}
if(w==-1)
{
System.out.println("该学号不存在。");
}
else
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 1、高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 2、大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 3、计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 4、数据库成绩:"+data[w].get_databasescore());
System.out.println(" 5、软件工程成绩:"+data[w].get_softwarescore());
System.out.println("***********************************************************");
int d=in.nextInt();
if(d==1)//修改高等数学成绩
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 请输入修改后的高等数学成绩:");
System.out.println("***********************************************************");
double d1=in.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 1、高等数学成绩:"+d1);
System.out.println(" 2、大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 3、计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 4、数据库成绩:"+data[w].get_databasescore());
System.out.println(" 5、软件工程成绩:"+data[w].get_softwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String d6=in.next();
if(ppp.equals(d6))
{
data[w].set_mathematicsscore(d1);
break;
}
}
if(d==2)//修改大学英语成绩
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 请输入修改后的大学英语成绩:");
System.out.println("***********************************************************");
double d2=in.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 1、高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 2、大学英语成绩:"+d2);
System.out.println(" 3、计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 4、数据库成绩:"+data[w].get_databasescore());
System.out.println(" 5、软件工程成绩:"+data[w].get_softwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String d7=in.next();
if(ppp.equals(d7))
{
data[w].set_englishiscore(d2);
break;
}
}
if(d==3)//修改计算机网络成绩
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 请输入修改后的计算机网络成绩:");
System.out.println("***********************************************************");
double d3=in.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 1、高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 2、大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 3、计算机网络成绩:"+d3);
System.out.println(" 4、数据库成绩:"+data[w].get_databasescore());
System.out.println(" 5、软件工程成绩:"+data[w].get_softwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String d8=in.next();
if(ppp.equals(d8))
{
data[w].set_networkscore(d3);
break;
}
}
if(d==4)//修改数据库成绩
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 请输入修改后的数据库成绩:");
System.out.println("***********************************************************");
double d4=in.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 1、高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 2、大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 3、计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 4、数据库成绩:"+d4);
System.out.println(" 5、软件工程成绩:"+data[w].get_softwarescore());
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String d9=in.next();
if(ppp.equals(d9))
{
data[w].set_databasescore(d4);
break;
}
}
if(d==5)//修改软件工程成绩
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 请输入修改后的软件工程成绩:");
System.out.println("***********************************************************");
double d5=in.nextDouble();
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
System.out.println(" 1、高等数学成绩:"+data[w].get_mathematicsscore());
System.out.println(" 2、大学英语成绩:"+data[w].get_englishiscore());
System.out.println(" 3、计算机网络成绩:"+data[w].get_networkscore());
System.out.println(" 4、数据库成绩:"+data[w].get_databasescore());
System.out.println(" 5、软件工程成绩:"+d5);
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N)");
System.out.println("***********************************************************");
String d10=in.next();
if(ppp.equals(d10))
{
data[w].set_softwarescore(d5);
break;
}
}
}
}
}
if(a==3)//计算学生成绩绩点
{
for(int k=0;;k++)
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩绩点计算界面");
System.out.println("***********************************************************");
System.out.println(" 请输入学生学号:(请输入八位学号)");
System.out.println("***********************************************************");
String b=in.next();
int w=-1;
for(int j=0;j<5;j++)
{
String c=data[j].get_stunumber();
if(b.equals(c))
{
w=j;
break;
}
}
if(w==-1)
{
System.out.println("该学号不存在。");
}
else
{
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 学生考试成绩绩点计算界面");
System.out.println("***********************************************************");
System.out.println(" 学生学号:"+data[w].get_stunumber());
System.out.println(" 学生姓名:"+data[w].get_name());
double d0,d1,d2=0;
d0=data[w].get_mathematicsscore();
d1=jidain(d0);
d2+=d1*4;
System.out.println(" 1、高等数学成绩绩点:"+d1);
d0=data[w].get_englishiscore();
d1=jidain(d0);
d2+=d1*3;
System.out.println(" 2、大学英语成绩绩点:"+d1);
d0=data[w].get_networkscore();
d1=jidain(d0);
d2+=d1*4;
System.out.println(" 3、计算机网络成绩绩点:"+d1);
d0=data[w].get_databasescore();
d1=jidain(d0);
d2+=d1*3;
System.out.println(" 4、数据库成绩绩点:"+d1);
d0=data[w].get_softwarescore();
d1=jidain(d0);
d2+=d1*2;
System.out.println(" 5、软件工程成绩绩点:"+d1);
d2/=16;
String d3=String.format("%.1f", d2);
System.out.println(" 你的平均学分绩点为:"+d3);
if(d2>=2)
{
System.out.println(" 提示信息:你的学分绩点已达到毕业要求!");
}
else
{
System.out.println(" 提示信息:你的学分绩点不满足毕业要求!");
}
System.out.println(" 是否返回系统主界面:(Y/N)");
System.out.println("***********************************************************");
String d4=in.next();
if(ppp.equals(d4))
{
break;
}
}
}
}
if(a==4)//退出学籍管理系统
{
System.out.println("***********************************************************");
System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 制作人:张千龙");
System.out.println("***********************************************************");
break;
}
}
}
}
private static double jidain(double d0) {
// TODO 自动生成的方法存根
double b=0.0;
if(d0>=75)
{
if(d0>=82)
{
if(d0>=90)
{
b=4.0;
}
else
{
if(d0>=85)
{
b=3.7;
}
else
{
b=3.3;
}
}
}
else
{
if(d0>=78)
{
b=3.0;
}
else
{
b=2.7;
}
}
}
else
{
if(d0>=68)
{
if(d0>=72)
{
b=2.3;
}
else
{
b=2.0;
}
}
else
{
if(d0>=64)
{
if(d0>=66)
{
b=1.7;
}
else
{
b=1.5;
}
}
else
{
if(b>=60)
{
b=1.0;
}
else
{
b=0.0;
}
}
}
}
return b;
}
}

















原文:https://www.cnblogs.com/zql-42/p/11515476.html