<span role="heading" aria-level="2">学生成绩管理系统</span>

心得:编程序很痛苦,但比编程序更痛苦的,是调试程序。
package xitong;
import java.util.Scanner;
class ScoreInformation {
private
String stunumber;
String name;
double mathematicsscore;
double englishiscore;
double networkscore;
double databasescore;
double softwarescore;
public
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;
}
void setstunumber(String stunumber)
{
this.stunumber=stunumber;
}
String getstunumber()
{
return stunumber;
}
void setname(String name)
{
this.name=name;
}
String getname()
{
return name;
}
void setmathematicsscore(double mathematicsscore)
{
this.mathematicsscore=mathematicsscore;
}
double getmathematicsscore()
{
return mathematicsscore;
}
void setenglishiscore(double englishiscore)
{
this.englishiscore=englishiscore;
}
double getenglishiscore()
{
return englishiscore;
}
void setnetworkscore(double networkscore)
{
this.networkscore=networkscore;
}
double getnetworkscore()
{
return networkscore;
}
void setdatabasescore(double databasescore)
{
this.databasescore=databasescore;
}
double getdatabasescore()
{
return databasescore;
}
void setsoftwarescore(double softwarescore)
{
this.softwarescore=softwarescore;
}
double getsoftwarescore()
{
return softwarescore;
}
//以上内容为变量获得初值
void caidan()
{ Scanner sr = new Scanner(System.in);//定义scanner,等待输入
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 h = sr.nextInt();
switch(h)
{
case 1:luru();
break;
case 2:xiugai();
break;
case 3:jisuan();
break;
case 4:exits();
break;
default:System.out.println("输入错误,请重试");
caidan();
}
}
void luru()
{
Scanner sr = new Scanner(System.in);//定义scanner,等待输入
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 请输入考生学号:xxxxxxxx ");
System.out.println("
");
String xuehao = sr.nextLine();
int m=0,n=0;
for(int i=0;i<5;i++)
{if (xuehao.equals (s[i].stunumber) )
{
m=1;
n=i;
}
}
if(m==0)
{
System.out.println("学号不存在");
luru();
}
else
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 请输入高等数学成绩: ");
System.out.println("
");
s[n].mathematicsscore=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 请输入大学英语成绩: ");
System.out.println("
");
s[n].englishiscore=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 请输入计算机网络成绩: ");
System.out.println("
");
s[n].networkscore=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 请输入数据库成绩: ");
System.out.println("
");
s[n].databasescore=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 请输入软件工程成绩: ");
System.out.println("
");
s[n].softwarescore=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 软件工程成绩: "+s[n].softwarescore+" ");
System.out.println(" 该学生成绩已录入完毕,是否提交(Y/N) ");
System.out.println("
");
sr.nextLine();
String flag=sr.nextLine();
if(flag.equals("Y"))
{
System.out.println("已保存");
caidan();
}
else if(flag=="N")
{
s[n].mathematicsscore=0.00;
s[n].englishiscore=0.00;
s[n].networkscore=0.00;
s[n].databasescore=0.00;
s[n].softwarescore=0.00;
luru();
}
}
}
void xiugai()
{
Scanner sr = new Scanner(System.in);//定义scanner,等待输入
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩修改界面 ");
System.out.println("
");
System.out.println(" 请输入学生学号:xxxxxxxx ");
System.out.println("
");
String xuehao = sr.nextLine();
int m=0,n=0;
for(int i=0;i<5;i++)
{if (xuehao.equals (s[i].stunumber) )
{
m=1;
n=i;
}
}
if(m==0)
{
System.out.println("学号不存在");
xiugai();
}
else
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 1、高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 2、大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 3、计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 4、数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 5、软件工程成绩: "+s[n].softwarescore+" ");
System.out.println("
");
int x=sr.nextInt();
switch(x)
{
case 1:
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入界面 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 请输入修改后高等数学成绩; ");
System.out.println("
");
double xiu=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+xiu+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 软件工程成绩: "+s[n].softwarescore+" ");
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N) ");
System.out.println("
");
sr.nextLine();
String flag=sr.nextLine();
if(flag.equals("Y"))
{
s[n].mathematicsscore=xiu;
System.out.println("已保存");
caidan();
}
else if(flag=="N")
{
System.out.println("已取消");
xiugai();
}
}
break;
case 2:
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入界面 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 请输入修改后大学英语成绩; ");
System.out.println("
");
double xiu=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+xiu+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 软件工程成绩: "+s[n].softwarescore+" ");
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N) ");
System.out.println("
");
sr.nextLine();
String flag=sr.nextLine();
if(flag.equals("Y"))
{
s[n].englishiscore=xiu;
System.out.println("已保存");
caidan();
}
else if(flag=="N")
{
System.out.println("已取消");
xiugai();
}
}
break;
case 3:
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入界面 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 请输入修改后计算机网络成绩; ");
System.out.println("
");
double xiu=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+xiu+" ");
System.out.println(" 数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 软件工程成绩: "+s[n].softwarescore+" ");
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N) ");
System.out.println("
");
sr.nextLine();
String flag=sr.nextLine();
if(flag.equals("Y"))
{
s[n].networkscore=xiu;
System.out.println("已保存");
caidan();
}
else if(flag=="N")
{
System.out.println("已取消");
xiugai();
}
}
break;
case 4:
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入界面 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 请输入修改后数据库成绩; ");
System.out.println("
");
double xiu=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 数据库成绩: "+xiu+" ");
System.out.println(" 软件工程成绩: "+s[n].softwarescore+" ");
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N) ");
System.out.println("
");
sr.nextLine();
String flag=sr.nextLine();
if(flag.equals("Y"))
{
s[n].databasescore=xiu;
System.out.println("已保存");
}
else if(flag=="N")
{
System.out.println("已取消");
xiugai();
}
}
break;
case 5:
{
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入界面 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 请输入修改后软件工程成绩; ");
System.out.println("
");
double xiu=sr.nextDouble();
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩录入 ");
System.out.println("
");
System.out.println(" 学生学号:"+xuehao+" ");
System.out.println(" 学生姓名:"+s[n].name+" ");
System.out.println(" 高等数学成绩:"+s[n].mathematicsscore+" ");
System.out.println(" 大学英语成绩:"+s[n].englishiscore+" ");
System.out.println(" 计算机网络成绩:"+s[n].networkscore+" ");
System.out.println(" 数据库成绩: "+s[n].databasescore+" ");
System.out.println(" 软件工程成绩: "+xiu+" ");
System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N) ");
System.out.println("
");
sr.nextLine();
String flag=sr.nextLine();
if(flag.equals("Y"))
{
s[n].softwarescore=xiu;
System.out.println("已保存");
caidan();
}
else if(flag=="N")
{
System.out.println("已取消");
xiugai();
}
}
break;
}
}
}
void jisuan()
{
Scanner sr = new Scanner(System.in);//定义scanner,等待输入
System.out.println("
");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
System.out.println(" 学生考试成绩绩点计算界面 ");
System.out.println("
");
System.out.println(" 请输入学生学号; ");
System.out.println("
*************************");
String xuehao=sr.nextLine();
int m=0,n=0;
for(int i=0;i<5;i++)
{if (xuehao.equals (s[i].stunumber) )
{
m=1;
n=i;
}
}
if(m==0)
{
System.out.println("学号不存在");
jisuan();
}
else
{
double a1,a2,a3,a4,a5,a6;
if(s[n].mathematicsscore>=90)
a1=4;
else if(s[n].mathematicsscore>=85&&s[n].mathematicsscore<90)
a1=3.7;
else if(s[n].mathematicsscore>=82&&s[n].mathematicsscore<85)
a1=3.3;
else if(s[n].mathematicsscore>=78&&s[n].mathematicsscore<82)
a1=3.0;
else if(s[n].mathematicsscore>=75&&s[n].mathematicsscore<78)
a1=2.7;
else if(s[n].mathematicsscore>=72&&s[n].mathematicsscore<75)
a1=2.3;
else if(s[n].mathematicsscore>=68&&s[n].mathematicsscore<72)
a1=2.0;
else if(s[n].mathematicsscore>=66&&s[n].mathematicsscore<68)
a1=1.7;
else if(s[n].mathematicsscore>=64&&s[n].mathematicsscore<66)
a1=1.5;
else if(s[n].mathematicsscore>=60&&s[n].mathematicsscore<64)
a1=1.0;
else
a1=0;
if(s[n].englishiscore>=90)
a2=4;
else if(s[n].englishiscore>=85&&s[n].englishiscore<90)
a2=3.7;
else if(s[n].englishiscore>=82&&s[n].englishiscore<85)
a2=3.3;
else if(s[n].englishiscore>=78&&s[n].englishiscore<82)
a2=3.0;
else if(s[n].englishiscore>=75&&s[n].englishiscore<78)
a2=2.7;
else if(s[n].englishiscore>=72&&s[n].englishiscore<75)
a2=2.3;
else if(s[n].englishiscore>=68&&s[n].englishiscore<72)
a2=2.0;
else if(s[n].englishiscore>=66&&s[n].englishiscore<68)
a2=1.7;
else if(s[n].englishiscore>=64&&s[n].englishiscore<66)
a2=1.5;
else if(s[n].englishiscore>=60&&s[n].englishiscore<64)
a2=1.0;
else
a2=0;

    		if(s[n].databasescore>=90)
    			a4=4;
    		else if(s[n].databasescore>=85&&s[n].databasescore<90)
    			a4=3.7;
    		else if(s[n].databasescore>=82&&s[n].databasescore<85)
    			a4=3.3;
    		else if(s[n].databasescore>=78&&s[n].databasescore<82)
    			a4=3.0;
    		else if(s[n].databasescore>=75&&s[n].databasescore<78)
    			a4=2.7;
    		else if(s[n].databasescore>=72&&s[n].databasescore<75)
    			a4=2.3;
    		else if(s[n].databasescore>=68&&s[n].databasescore<72)
    			a4=2.0;
    		else if(s[n].databasescore>=66&&s[n].databasescore<68)
    			a4=1.7;
    		else if(s[n].databasescore>=64&&s[n].databasescore<66)
    			a4=1.5;
    		else if(s[n].databasescore>=60&&s[n].databasescore<64)
    			a4=1.0;
    		else 
    			a4=0;
    		
    		if(s[n].softwarescore>=90)
    			a5=4;
    		else if(s[n].softwarescore>=85&&s[n].softwarescore<90)
    			a5=3.7;
    		else if(s[n].softwarescore>=82&&s[n].softwarescore<85)
    			a5=3.3;
    		else if(s[n].softwarescore>=78&&s[n].softwarescore<82)
    			a5=3.0;
    		else if(s[n].softwarescore>=75&&s[n].softwarescore<78)
    			a5=2.7;
    		else if(s[n].softwarescore>=72&&s[n].softwarescore<75)
    			a5=2.3;
    		else if(s[n].softwarescore>=68&&s[n].softwarescore<72)
    			a5=2.0;
    		else if(s[n].softwarescore>=66&&s[n].softwarescore<68)
    			a5=1.7;
    		else if(s[n].softwarescore>=64&&s[n].softwarescore<66)
    			a5=1.5;
    		else if(s[n].softwarescore>=60&&s[n].softwarescore<64)
    			a5=1.0;
    		else 
    			a5=0;
    		if(s[n].networkscore>=90)
    			a3=4;
    		else if(s[n].networkscore>=85&&s[n].networkscore<90)
    			a3=3.7;
    		else if(s[n].networkscore>=82&&s[n].networkscore<85)
    			a3=3.3;
    		else if(s[n].networkscore>=78&&s[n].networkscore<82)
    			a3=3.0;
    		else if(s[n].networkscore>=75&&s[n].networkscore<78)
    			a3=2.7;
    		else if(s[n].networkscore>=72&&s[n].networkscore<75)
    			a3=2.3;
    		else if(s[n].networkscore>=68&&s[n].networkscore<72)
    			a3=2.0;
    		else if(s[n].networkscore>=66&&s[n].networkscore<68)
    			a3=1.7;
    		else if(s[n].networkscore>=64&&s[n].networkscore<66)
    			a3=1.5;
    		else if(s[n].networkscore>=60&&s[n].networkscore<64)
    			a3=1.0;
    		else 
    			a3=0;
    		Double b=(a1*4+a2*3+a3*4+a4*3+a5*2)/16;
    		System.out.println("***********************************************************");
    		System.out.println("                 石家庄铁道大学软件工程系                                            ");
    		System.out.println("                 学生学籍管理系统 2019 版                                            ");
    		System.out.println("***********************************************************");	
    		System.out.println("                  学生学号: "+s[n].stunumber+"              ");
    		System.out.println("                  学生姓名:  "+s[n].name+"                  ");
    		System.out.println("                1、高等数学成绩绩点:"+a1+"                   ");
    		System.out.println("                2、大学英语成绩绩点:"+a2+"                   ");
    		System.out.println("                3、计算机网络成绩绩点: "+a3+"                 ");
    		System.out.println("                4、数据库成绩绩点: "+a4 +"                   ");
    		System.out.println("                5、软件工程成绩绩点:"+a5+"                   ");
    		if(b>=2)
    		{
    			System.out.println("                你的学分绩点已达到毕业要求                                 ");
    			System.out.println("               是否返回系统主界面:(Y/N)                                ");
    			System.out.println("*******************************************************");
    			String flag=sr.nextLine();
    			if(flag.equals("Y"))
            	{
            		caidan();
            	}
            	else if(flag=="N")
            	{
                    caidan();
            	}
    		}
    		else
    		{
    			System.out.println("                你的学分绩点不满足毕业要求!                                ");
    			System.out.println("               是否返回系统主界面:(Y/N)                                ");
    			System.out.println("*******************************************************");
    			sr.nextLine();
    			String flag=sr.nextLine();
    			if(flag.equals("Y"))
            	{
            		caidan();
            	}
            	else if(flag=="N")
            	{
                    caidan();
            	}
    		}
    	}
    }
    void exits()
    {
    	System.out.println("************************************************");
    	System.out.println("谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
    	System.out.println("            制作人 张志伟                                                   ");
    	System.out.println("************************************************");
    }

public ScoreInformation()
{

}
static ScoreInformation[]s;
public static void main(String[]args)
{
s=new ScoreInformation[5];
s[0]=new ScoreInformation("20183583","张志伟",0,0,0,0,0);
s[1]=new ScoreInformation("20183581","张一",0,0,0,0,0);
s[2]=new ScoreInformation("20183582","张二",0,0,0,0,0);
s[3]=new ScoreInformation("20183584","张三",0,0,0,0,0);
s[4]=new ScoreInformation("20183585","张四",0,0,0,0,0);
ScoreInformation p= new ScoreInformation();
p.caidan();
}
}

全部评论

相关推荐

头像
05-14 12:29
安卓
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务