设计一个学生成绩管理系统:要求可以满足成绩的录入;成绩的修改;将成绩换算成学分绩点;最后可以退出。
源代码如下:
1 //信1805-3 田文静 20183683 2 3 package org.yuan.Day1; 4 5 public class ScoreInformation { 6 private String stunumber; 7 private String name; 8 private double mathematicsscore; 9 private double englishiscore; 10 private double networkscore; 11 private double databasescore; 12 private double softwarescore; 13 public ScoreInformation(){ 14 stunumber=null; 15 name=null; 16 mathematicsscore=0.0; 17 englishiscore=0.0; 18 networkscore=0.0; 19 databasescore=0.0; 20 softwarescore=0.0; 21 } 22 23 void Setstunumber(String number) 24 { 25 stunumber=number; 26 27 } 28 String Getstunumber() 29 { 30 return stunumber; 31 } 32 void Setname(String mingzi) 33 { 34 name=mingzi; 35 36 } 37 String Getname() 38 { 39 return name; 40 } 41 42 void Setmathematicsscore(double math) 43 { 44 mathematicsscore=math; 45 46 } 47 public double Getmathematicsscore() 48 { 49 return mathematicsscore; 50 } 51 public void Setenglishiscore(double english) 52 { 53 englishiscore=english; 54 55 } 56 public double Getenglishiscore() 57 { 58 return englishiscore; 59 } 60 public void Setnetworkscore(double net) 61 { 62 networkscore=net; 63 64 } 65 public double Getnetworkscore() 66 { 67 return networkscore; 68 } 69 public void Setdatabasescore(double data) 70 { 71 databasescore=data; 72 73 } 74 public double Getdatabasescore() 75 { 76 return databasescore; 77 } 78 public void Setsoftwarescore(double soft) 79 { 80 softwarescore=soft; 81 82 } 83 public double Getsoftwarescore() 84 { 85 return softwarescore; 86 } 87 88 89 90 91 92 93 }
//信1805-3 田文静 20183683
package org.yuan.Day1;
package org.yuan.Day1;
import java.util.Hashtable;
import java.util.Scanner;
public class ScoreManagement {
static ScoreInformation []s=new ScoreInformation[5];
static int n=1;
static Hashtable <String,ScoreInformation> ht= new Hashtable< String,ScoreInformation>();
static String stunumber,name;
static double mathematicsscore;
static double englishiscore;
static double networkscore;
static double databasescore;
static double softwarescore;
static Scanner sc=new Scanner(System.in);
//主界面
static 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("**************************************");
}
//退出界面
static void tuichu() {
System.out.println("**************************************");
System.out.println("谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 制作人:田文静");
System.out.println("**************************************");
}
//录入界面
static void luru() {
System.out.println("**************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("**************************************");
System.out.println(" 请输入学生学号:");
System.out.println("**************************************");
}
//修改界面
static void xiugai() {
System.out.println("**************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("**************************************");
System.out.println(" 请输入学生学号:");
System.out.println("**************************************");
}
//计算界面
static void jisuan() {
System.out.println("**************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩几点计算界面");
System.out.println("**************************************");
System.out.println(" 请输入学生学号:");
System.out.println("**************************************");
}
//录入学生成绩
static void Luru(){
System.out.println("请输入学号:");
stunumber=sc.next();
int flag=0;
for(int i=0;i<n;i++)
{
if(stunumber.equals(s[i].Getstunumber()))
{
System.out.println("姓名:"+s[i].Getname());
System.out.println("请输入高数成绩:");
mathematicsscore=sc.nextDouble();
System.out.println("请输入英语成绩:");
englishiscore=sc.nextDouble();
System.out.println("请输入计算机网络的成绩:");
networkscore=sc.nextDouble();
System.out.println("请输入数据库成绩:");
databasescore=sc.nextDouble();
System.out.println("请输入软件工程成绩:");
softwarescore=sc.nextDouble();
s[i].Setstunumber(stunumber);
s[i].Setmathematicsscore(mathematicsscore);
s[i].Setenglishiscore(englishiscore);
s[i].Setnetworkscore(networkscore);
s[i].Setdatabasescore(databasescore);
s[i].Setsoftwarescore(softwarescore);
ht.put(stunumber,s[i]);
System.out.println("该学生成绩已录入完毕,是否提交(Y/N)!\n");
String ch=sc.next();
if(ch.equals("N"))
{
s[i].Setmathematicsscore(0.0);
s[i].Setenglishiscore(0);
s[i].Setnetworkscore(0);
s[i].Setdatabasescore(0);
s[i].Setsoftwarescore(0);
}
flag=1;
break;
}
}
if(flag==0)
System.out.println("该学号不存在!");
}
//修改学生成绩
static void Xiugai()
{
System.out.println("请输入要修改学生的学号:");
stunumber=sc.next();
int flag=0;
for(int i=0;i<n;i++) {
if(stunumber.equals(s[i].Getstunumber())) {
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("姓名:"+s[i].Getname());
System.out.printf("1、高数成绩:"+s[i].Getmathematicsscore()+"\n");
System.out.printf("2、英语成绩:"+s[i].Getenglishiscore()+"\n");
System.out.printf("3、计算机网络成绩:"+s[i].Getnetworkscore()+"\n");
System.out.printf("4、数据库成绩:"+s[i].Getdatabasescore()+"\n");
System.out.printf("5、软件工程成绩:"+s[i].Getsoftwarescore()+"\n");
int c;
c=sc.nextInt();
double x=0;
switch(c) {
case 1:
x=s[i].Getmathematicsscore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的高数成绩:");
mathematicsscore=sc.nextDouble();
s[i].Setmathematicsscore(mathematicsscore);
break;
case 2:
x=s[i].Getenglishiscore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的英语成绩:");
englishiscore=sc.nextDouble();
s[i].Setenglishiscore(englishiscore);
break;
case 3:
x=s[i].Getnetworkscore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的计算机网络成绩:");
networkscore=sc.nextDouble();
s[i].Setnetworkscore(networkscore);
break;
case 4:
x=s[i].Getdatabasescore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的数据库成绩:");
databasescore=sc.nextDouble();
s[i].Setdatabasescore(databasescore);
break;
case 5:
x=s[i].Getsoftwarescore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的软件工程成绩:");
softwarescore=sc.nextDouble();
s[i].Setsoftwarescore(softwarescore);
break;
}
flag=1;
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("姓名:"+s[i].Getname());
System.out.printf("1、高数成绩:"+s[i].Getmathematicsscore()+"\n");
System.out.printf("2、英语成绩:"+s[i].Getenglishiscore()+"\n");
System.out.printf("3、计算机网络成绩:"+s[i].Getnetworkscore()+"\n");
System.out.printf("4、数据库成绩:"+s[i].Getdatabasescore()+"\n");
System.out.printf("5、软件工程成绩:"+s[i].Getsoftwarescore()+"\n");
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
String ch=sc.next();
if(ch.contentEquals("Y"))
{
System.out.println("修改成功!");
}
else
{
if(c==1) {s[i].Setmathematicsscore(x);}
else if(c==2) {s[i].Setenglishiscore(x);}
else if(c==3) {s[i].Setnetworkscore(x);}
else if(c==4) {s[i].Setdatabasescore(x);}
else {s[i].Setsoftwarescore(x);}
}
}
if(flag==0)
System.out.println("输入学号错误!");
}
}
static void Jidian() {
double []a=new double[5];//存各科绩点
double f=0;
System.out.print("请输入要查看学生绩点的成绩:");
String number=sc.next();
int flag=0;
int i;
for(i=0;i<5;i++) {
if(number.equals(s[i].Getstunumber()))
{
if(s[i].Getmathematicsscore()>=75)
{
if(s[i].Getmathematicsscore()<78)
{
a[0]=2.7;
}
else if(s[i].Getmathematicsscore()<=81.9)
{
a[0]=3.0;
}
else if(s[i].Getmathematicsscore()<=84.9)
{
a[0]=3.3;
}
else if(s[i].Getmathematicsscore()<=89.9)
{
a[0]=3.7;
}
else
{
a[0]=4.0;
}
}
else
{
if(s[i].Getmathematicsscore()>=72)
{
a[0]=2.3;
}
else if(s[i].Getmathematicsscore()>=68)
{
a[0]=2.1;
}
else if(s[i].Getmathematicsscore()>=66)
{
a[0]=1.7;
}
else if(s[i].Getmathematicsscore()>=74)
{
a[0]=1.5;
}
else if(s[i].Getmathematicsscore()>=60)
{
a[0]=1.0;
}
else
{
a[0]=0;
}
}
if(s[i].Getenglishiscore()>=75)
{
if(s[i].Getenglishiscore()<78)
{
a[1]=2.025;
}
else if(s[i].Getenglishiscore()<=81.9)
{
a[1]=2.25;
}
else if(s[i].Getenglishiscore()<=84.9)
{
a[1]=2.475;
}
else if(s[i].Getenglishiscore()<=89.9)
{
a[1]=2.775;
}
else
{
a[1]=3.0;
}
}
else
{
if(s[i].Getenglishiscore()>=72)
{
a[1]=1.725;
}
else if(s[i].Getenglishiscore()>=68)
{
a[1]=1.575;
}
else if(s[i].Getenglishiscore()>=66)
{
a[1]=1.275;
}
else if(s[i].Getenglishiscore()>=74)
{
a[1]=1.125;
}
else if(s[i].Getenglishiscore()>=60)
{
a[1]=0.75;
}
else
{
a[1]=0;
}
}
if(s[i].Getnetworkscore()>=75)
{
if(s[i].Getnetworkscore()<78)
{
a[2]=2.7;
}
else if(s[i].Getnetworkscore()<=81.9)
{
a[2]=3.0;
}
else if(s[i].Getnetworkscore()<=84.9)
{
a[2]=3.3;
}
else if(s[i].Getnetworkscore()<=89.9)
{
a[2]=3.7;
}
else
{
a[2]=4.0;
}
}
else
{
if(s[i].Getnetworkscore()>=72)
{
a[2]=2.3;
}
else if(s[i].Getnetworkscore()>=68)
{
a[2]=2.1;
}
else if(s[i].Getnetworkscore()>=66)
{
a[2]=1.7;
}
else if(s[i].Getnetworkscore()>=74)
{
a[2]=1.5;
}
else if(s[i].Getnetworkscore()>=60)
{
a[2]=1.0;
}
else
{
a[2]=0;
}
}
if(s[i].Getdatabasescore()>=75)
{
if(s[i].Getdatabasescore()<78)
{
a[3]=2.025;
}
else if(s[i].Getdatabasescore()<=81.9)
{
a[3]=2.25;
}
else if(s[i].Getdatabasescore()<=84.9)
{
a[3]=2.475;
}
else if(s[i].Getdatabasescore()<=89.9)
{
a[3]=2.775;
}
else
{
a[3]=3.0;
}
}
else
{
if(s[i].Getdatabasescore()>=72)
{
a[3]=1.725;
}
else if(s[i].Getdatabasescore()>=68)
{
a[3]=1.575;
}
else if(s[i].Getdatabasescore()>=66)
{
a[3]=1.275;
}
else if(s[i].Getdatabasescore()>=74)
{
a[3]=1.125;
}
else if(s[i].Getdatabasescore()>=60)
{
a[3]=0.75;
}
else
{
a[3]=0;
}
}
if(s[i].Getsoftwarescore()>=75)
{
if(s[i].Getsoftwarescore()<78)
{
a[4]=1.35;
}
else if(s[i].Getsoftwarescore()<=81.9)
{
a[4]=1.5;
}
else if(s[i].Getsoftwarescore()<=84.9)
{
a[4]=1.65;
}
else if(s[i].Getsoftwarescore()<=89.9)
{
a[4]=1.85;
}
else
{
a[4]=2.0;
}
}
else
{
if(s[i].Getsoftwarescore()>=72)
{
a[4]=1.15;
}
else if(s[i].Getsoftwarescore()>=68)
{
a[4]=1.05;
}
else if(s[i].Getsoftwarescore()>=66)
{
a[4]=0.85;
}
else if(s[i].Getsoftwarescore()>=74)
{
a[4]=0.75;
}
else if(s[i].Getsoftwarescore()>=60)
{
a[4]=0.5;
}
else
{
a[4]=0;
}
}
f=(a[0]*4+a[1]*3+a[2]*4+a[3]*3+a[4]*2)/16;
flag=1;
break;
}
}
if(flag==1) {
jisuan();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("1、高等数学成绩绩点:"+a[0]);
System.out.println("2、英语成绩绩点:"+a[1]);
System.out.println("3、计算机网络成绩绩点:"+a[2]);
System.out.println("4、数据库成绩绩点:"+a[3]);
System.out.println("5、软件工程成绩绩点:"+a[4]);
System.out.print("平均绩点:"+f);
if(f<2.0) {System.out.println("你的学分绩点不满足要求!");}
else {System.out.println("你的学分绩点已达到毕业要求!");}
}
else
{System.out.println("输入学号错误!");}
}
@SuppressWarnings("resource")
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i<5;i++)
s[i]=new ScoreInformation();
s[0].Setstunumber("12345678");
s[0].Setname("张三");
s[1].Setstunumber("23456789");
s[1].Setname("李四");
s[2].Setstunumber("34567890");
s[2].Setname("王五");
s[3].Setstunumber("45678901");
s[3].Setname("李林");
s[4].Setstunumber("56789012");
s[4].Setname("张飞");
Scanner sc=new Scanner(System.in);
show();
int c;
while(true) {
c=sc.nextInt();
switch(c) {
case 1:
luru();
Luru();
show();
break;
case 2:
xiugai();
Xiugai();
show();
break;
case 3:
jisuan();
Jidian();
show();
break;
case 4:
tuichu();
break;
}
}
}
}
static ScoreInformation []s=new ScoreInformation[5];
static int n=1;
static Hashtable <String,ScoreInformation> ht= new Hashtable< String,ScoreInformation>();
static String stunumber,name;
static double mathematicsscore;
static double englishiscore;
static double networkscore;
static double databasescore;
static double softwarescore;
static Scanner sc=new Scanner(System.in);
//主界面
static 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("**************************************");
}
//退出界面
static void tuichu() {
System.out.println("**************************************");
System.out.println("谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
System.out.println(" 制作人:田文静");
System.out.println("**************************************");
}
//录入界面
static void luru() {
System.out.println("**************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println("**************************************");
System.out.println(" 请输入学生学号:");
System.out.println("**************************************");
}
//修改界面
static void xiugai() {
System.out.println("**************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("**************************************");
System.out.println(" 请输入学生学号:");
System.out.println("**************************************");
}
//计算界面
static void jisuan() {
System.out.println("**************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩几点计算界面");
System.out.println("**************************************");
System.out.println(" 请输入学生学号:");
System.out.println("**************************************");
}
//录入学生成绩
static void Luru(){
System.out.println("请输入学号:");
stunumber=sc.next();
int flag=0;
for(int i=0;i<n;i++)
{
if(stunumber.equals(s[i].Getstunumber()))
{
System.out.println("姓名:"+s[i].Getname());
System.out.println("请输入高数成绩:");
mathematicsscore=sc.nextDouble();
System.out.println("请输入英语成绩:");
englishiscore=sc.nextDouble();
System.out.println("请输入计算机网络的成绩:");
networkscore=sc.nextDouble();
System.out.println("请输入数据库成绩:");
databasescore=sc.nextDouble();
System.out.println("请输入软件工程成绩:");
softwarescore=sc.nextDouble();
s[i].Setstunumber(stunumber);
s[i].Setmathematicsscore(mathematicsscore);
s[i].Setenglishiscore(englishiscore);
s[i].Setnetworkscore(networkscore);
s[i].Setdatabasescore(databasescore);
s[i].Setsoftwarescore(softwarescore);
ht.put(stunumber,s[i]);
System.out.println("该学生成绩已录入完毕,是否提交(Y/N)!\n");
String ch=sc.next();
if(ch.equals("N"))
{
s[i].Setmathematicsscore(0.0);
s[i].Setenglishiscore(0);
s[i].Setnetworkscore(0);
s[i].Setdatabasescore(0);
s[i].Setsoftwarescore(0);
}
flag=1;
break;
}
}
if(flag==0)
System.out.println("该学号不存在!");
}
//修改学生成绩
static void Xiugai()
{
System.out.println("请输入要修改学生的学号:");
stunumber=sc.next();
int flag=0;
for(int i=0;i<n;i++) {
if(stunumber.equals(s[i].Getstunumber())) {
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("姓名:"+s[i].Getname());
System.out.printf("1、高数成绩:"+s[i].Getmathematicsscore()+"\n");
System.out.printf("2、英语成绩:"+s[i].Getenglishiscore()+"\n");
System.out.printf("3、计算机网络成绩:"+s[i].Getnetworkscore()+"\n");
System.out.printf("4、数据库成绩:"+s[i].Getdatabasescore()+"\n");
System.out.printf("5、软件工程成绩:"+s[i].Getsoftwarescore()+"\n");
int c;
c=sc.nextInt();
double x=0;
switch(c) {
case 1:
x=s[i].Getmathematicsscore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的高数成绩:");
mathematicsscore=sc.nextDouble();
s[i].Setmathematicsscore(mathematicsscore);
break;
case 2:
x=s[i].Getenglishiscore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的英语成绩:");
englishiscore=sc.nextDouble();
s[i].Setenglishiscore(englishiscore);
break;
case 3:
x=s[i].Getnetworkscore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的计算机网络成绩:");
networkscore=sc.nextDouble();
s[i].Setnetworkscore(networkscore);
break;
case 4:
x=s[i].Getdatabasescore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的数据库成绩:");
databasescore=sc.nextDouble();
s[i].Setdatabasescore(databasescore);
break;
case 5:
x=s[i].Getsoftwarescore();
luru();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("请输入修改后的软件工程成绩:");
softwarescore=sc.nextDouble();
s[i].Setsoftwarescore(softwarescore);
break;
}
flag=1;
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("姓名:"+s[i].Getname());
System.out.printf("1、高数成绩:"+s[i].Getmathematicsscore()+"\n");
System.out.printf("2、英语成绩:"+s[i].Getenglishiscore()+"\n");
System.out.printf("3、计算机网络成绩:"+s[i].Getnetworkscore()+"\n");
System.out.printf("4、数据库成绩:"+s[i].Getdatabasescore()+"\n");
System.out.printf("5、软件工程成绩:"+s[i].Getsoftwarescore()+"\n");
System.out.println("该学生成绩已修改完毕,是否提交(Y/N)");
String ch=sc.next();
if(ch.contentEquals("Y"))
{
System.out.println("修改成功!");
}
else
{
if(c==1) {s[i].Setmathematicsscore(x);}
else if(c==2) {s[i].Setenglishiscore(x);}
else if(c==3) {s[i].Setnetworkscore(x);}
else if(c==4) {s[i].Setdatabasescore(x);}
else {s[i].Setsoftwarescore(x);}
}
}
if(flag==0)
System.out.println("输入学号错误!");
}
}
static void Jidian() {
double []a=new double[5];//存各科绩点
double f=0;
System.out.print("请输入要查看学生绩点的成绩:");
String number=sc.next();
int flag=0;
int i;
for(i=0;i<5;i++) {
if(number.equals(s[i].Getstunumber()))
{
if(s[i].Getmathematicsscore()>=75)
{
if(s[i].Getmathematicsscore()<78)
{
a[0]=2.7;
}
else if(s[i].Getmathematicsscore()<=81.9)
{
a[0]=3.0;
}
else if(s[i].Getmathematicsscore()<=84.9)
{
a[0]=3.3;
}
else if(s[i].Getmathematicsscore()<=89.9)
{
a[0]=3.7;
}
else
{
a[0]=4.0;
}
}
else
{
if(s[i].Getmathematicsscore()>=72)
{
a[0]=2.3;
}
else if(s[i].Getmathematicsscore()>=68)
{
a[0]=2.1;
}
else if(s[i].Getmathematicsscore()>=66)
{
a[0]=1.7;
}
else if(s[i].Getmathematicsscore()>=74)
{
a[0]=1.5;
}
else if(s[i].Getmathematicsscore()>=60)
{
a[0]=1.0;
}
else
{
a[0]=0;
}
}
if(s[i].Getenglishiscore()>=75)
{
if(s[i].Getenglishiscore()<78)
{
a[1]=2.025;
}
else if(s[i].Getenglishiscore()<=81.9)
{
a[1]=2.25;
}
else if(s[i].Getenglishiscore()<=84.9)
{
a[1]=2.475;
}
else if(s[i].Getenglishiscore()<=89.9)
{
a[1]=2.775;
}
else
{
a[1]=3.0;
}
}
else
{
if(s[i].Getenglishiscore()>=72)
{
a[1]=1.725;
}
else if(s[i].Getenglishiscore()>=68)
{
a[1]=1.575;
}
else if(s[i].Getenglishiscore()>=66)
{
a[1]=1.275;
}
else if(s[i].Getenglishiscore()>=74)
{
a[1]=1.125;
}
else if(s[i].Getenglishiscore()>=60)
{
a[1]=0.75;
}
else
{
a[1]=0;
}
}
if(s[i].Getnetworkscore()>=75)
{
if(s[i].Getnetworkscore()<78)
{
a[2]=2.7;
}
else if(s[i].Getnetworkscore()<=81.9)
{
a[2]=3.0;
}
else if(s[i].Getnetworkscore()<=84.9)
{
a[2]=3.3;
}
else if(s[i].Getnetworkscore()<=89.9)
{
a[2]=3.7;
}
else
{
a[2]=4.0;
}
}
else
{
if(s[i].Getnetworkscore()>=72)
{
a[2]=2.3;
}
else if(s[i].Getnetworkscore()>=68)
{
a[2]=2.1;
}
else if(s[i].Getnetworkscore()>=66)
{
a[2]=1.7;
}
else if(s[i].Getnetworkscore()>=74)
{
a[2]=1.5;
}
else if(s[i].Getnetworkscore()>=60)
{
a[2]=1.0;
}
else
{
a[2]=0;
}
}
if(s[i].Getdatabasescore()>=75)
{
if(s[i].Getdatabasescore()<78)
{
a[3]=2.025;
}
else if(s[i].Getdatabasescore()<=81.9)
{
a[3]=2.25;
}
else if(s[i].Getdatabasescore()<=84.9)
{
a[3]=2.475;
}
else if(s[i].Getdatabasescore()<=89.9)
{
a[3]=2.775;
}
else
{
a[3]=3.0;
}
}
else
{
if(s[i].Getdatabasescore()>=72)
{
a[3]=1.725;
}
else if(s[i].Getdatabasescore()>=68)
{
a[3]=1.575;
}
else if(s[i].Getdatabasescore()>=66)
{
a[3]=1.275;
}
else if(s[i].Getdatabasescore()>=74)
{
a[3]=1.125;
}
else if(s[i].Getdatabasescore()>=60)
{
a[3]=0.75;
}
else
{
a[3]=0;
}
}
if(s[i].Getsoftwarescore()>=75)
{
if(s[i].Getsoftwarescore()<78)
{
a[4]=1.35;
}
else if(s[i].Getsoftwarescore()<=81.9)
{
a[4]=1.5;
}
else if(s[i].Getsoftwarescore()<=84.9)
{
a[4]=1.65;
}
else if(s[i].Getsoftwarescore()<=89.9)
{
a[4]=1.85;
}
else
{
a[4]=2.0;
}
}
else
{
if(s[i].Getsoftwarescore()>=72)
{
a[4]=1.15;
}
else if(s[i].Getsoftwarescore()>=68)
{
a[4]=1.05;
}
else if(s[i].Getsoftwarescore()>=66)
{
a[4]=0.85;
}
else if(s[i].Getsoftwarescore()>=74)
{
a[4]=0.75;
}
else if(s[i].Getsoftwarescore()>=60)
{
a[4]=0.5;
}
else
{
a[4]=0;
}
}
f=(a[0]*4+a[1]*3+a[2]*4+a[3]*3+a[4]*2)/16;
flag=1;
break;
}
}
if(flag==1) {
jisuan();
System.out.println("学生学号:"+s[i].Getstunumber());
System.out.println("学生姓名:"+s[i].Getname());
System.out.println("1、高等数学成绩绩点:"+a[0]);
System.out.println("2、英语成绩绩点:"+a[1]);
System.out.println("3、计算机网络成绩绩点:"+a[2]);
System.out.println("4、数据库成绩绩点:"+a[3]);
System.out.println("5、软件工程成绩绩点:"+a[4]);
System.out.print("平均绩点:"+f);
if(f<2.0) {System.out.println("你的学分绩点不满足要求!");}
else {System.out.println("你的学分绩点已达到毕业要求!");}
}
else
{System.out.println("输入学号错误!");}
}
@SuppressWarnings("resource")
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i<5;i++)
s[i]=new ScoreInformation();
s[0].Setstunumber("12345678");
s[0].Setname("张三");
s[1].Setstunumber("23456789");
s[1].Setname("李四");
s[2].Setstunumber("34567890");
s[2].Setname("王五");
s[3].Setstunumber("45678901");
s[3].Setname("李林");
s[4].Setstunumber("56789012");
s[4].Setname("张飞");
Scanner sc=new Scanner(System.in);
show();
int c;
while(true) {
c=sc.nextInt();
switch(c) {
case 1:
luru();
Luru();
show();
break;
case 2:
xiugai();
Xiugai();
show();
break;
case 3:
jisuan();
Jidian();
show();
break;
case 4:
tuichu();
break;
}
}
}
}
因为我还是初学者,代码可能把较麻烦,也许有的不必要,方法麻烦。如果有好的方法,欢迎提意见!