码迷,mamicode.com
首页 > 编程语言 > 详细

开学考试学生成绩管理Java

时间:2019-09-12 23:30:18      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:else   method   考试   class   xxxx   shp   int   return   工程   

首先student类

package xuexi;

public class Student {

private String stunumber;
private String name;
private double mathematicsscore;
private double englishiscore;
private double networkscore;
private double databasescore;
private double softwarescore;
public Student(){}
public Student(String stunumber,String name,float mathematicsscore,float englishiscore,float networkscore,float databasescore,float softwarescore){
this.stunumber=stunumber;
this.name=name;
this.mathematicsscore=mathematicsscore;
this.englishiscore=englishiscore;
this.networkscore=networkscore;
this.databasescore=databasescore;
this.softwarescore=softwarescore;

}
public String getstunumber(){
return stunumber;
}
public void setstunumber(String getstunumber){
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 x1) {
this.mathematicsscore = x1;
}
public double getenglishiscore() {
return englishiscore;
}
public void setenglishiscore(double d) {
this.englishiscore = d;
}
public double getdatabasescore() {
return databasescore;
}
public void setdatabasescore(double d) {
this.databasescore = d;
}
public double getnetworkscore() {
return networkscore;
}
public void setnetworkscore(double d) {
this.networkscore = d;
}
public double getsoftwarescore() {
return softwarescore;
}
public void setsoftwarescore(double x5) {
this.softwarescore = x5;
}
}

然后是xuexi类

package xuexi;

import java.util.Scanner;
import xuexi.Student;
public class Helo {
static Scanner sc = new Scanner(System.in);
static Student s[] = new Student[100];
static int n=0;
public static void meun()
{
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("***********************************************************");
System.out.println("请选择。。。");
int t=sc.nextInt();
switch(t)
{
case 1:luru();break;
case 2:xiuga();break;
case 3:jisuan();break;
case 4:tuichu();break;
default :System.out.println("请重新输入。。。");meun();break;
}
}

public static void kaishi()
{int i=0;
for(i=0;i<5;i++)
{
s[i]=new Student();
}
s[0] = new Student();
s[0].setstunumber("20183617");
s[0].setname("孙鸿滨");
s[0].setmathematicsscore(0);
s[0].setenglishiscore(0);
s[0].setnetworkscore(0);
s[0].setdatabasescore(0);
s[0].setsoftwarescore(0);
s[1] = new Student();
s[1].setstunumber("20181234");
s[1].setname("张三");
s[1].setmathematicsscore(0);
s[1].setenglishiscore(0);
s[1].setnetworkscore(0);
s[1].setdatabasescore(0);
s[1].setsoftwarescore(0);
s[2] = new Student();
s[2].setstunumber("20185647");
s[2].setname("李四");
s[2].setmathematicsscore(0);
s[2].setenglishiscore(0);
s[2].setnetworkscore(0);
s[2].setdatabasescore(0);
s[2].setsoftwarescore(0);
s[3] = new Student();
s[3].setstunumber("20181245");
s[3].setname("王五");
s[3].setmathematicsscore(0);
s[3].setenglishiscore(0);
s[3].setnetworkscore(0);
s[3].setdatabasescore(0);
s[3].setsoftwarescore(0);
s[4] = new Student();
s[4].setstunumber("20183355");
s[4].setname("李六");
s[4].setmathematicsscore(0);
s[4].setenglishiscore(0);
s[4].setnetworkscore(0);
s[4].setdatabasescore(0);
s[4].setsoftwarescore(0);
}
public static void tuichu()
{
System.out.println("****************************************************");
System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 制作人:孙鸿滨");
System.out.println("****************************************************");
System.exit(-1);
}
public static void luru()
{
while(true)
{
int t=0;
System.out.println("*****************************************************" );
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版" );
System.out.println(" 学生考试成绩录入界面" );
System.out.println("****************************************************" );
System.out.println(" 请输入学生学号:********");
System.out.println("****************************************************");
System.out.println("请输入八位的学号:");
String a=sc.next();

for(int i=0;i<n;i++)
{
if(a.equals(s[i].getstunumber()))
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 请输入高等数学成绩:");
System.out.println("****************************************************");
s[i].setmathematicsscore(sc.nextDouble());
if(s[i].getmathematicsscore()>0&&s[i].getmathematicsscore()<=100)
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 请输入大学英语成绩:");
System.out.println("****************************************************");
s[i].setenglishiscore(sc.nextDouble());
if(s[i].getenglishiscore()>0&&s[i].getenglishiscore()<=100)
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 大学英语成绩:"+s[i].getenglishiscore());
System.out.println(" 请输入计算机网络成绩:");
System.out.println("****************************************************");
s[i].setnetworkscore(sc.nextDouble());
if(s[i].getnetworkscore()>0&&s[i].getnetworkscore()<=100)
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 大学英语成绩:"+s[i].getenglishiscore());
System.out.println(" 计算机网络成绩:"+s[i].getnetworkscore());
System.out.println(" 请输入数据库成绩:");
System.out.println("****************************************************");
s[i].setdatabasescore(sc.nextDouble());
if(s[i].getdatabasescore()>0&&s[i].getdatabasescore()<100)
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 大学英语成绩:"+s[i].getenglishiscore());
System.out.println(" 计算机网络成绩:"+s[i].getnetworkscore());
System.out.println(" 输入数据库成绩:"+s[i].getdatabasescore());
System.out.println(" 请输入软件工程成绩:");
System.out.println("****************************************************");
s[i].setsoftwarescore(sc.nextDouble());
if(s[i].getsoftwarescore()>0&&s[i].getsoftwarescore()<=100)
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 大学英语成绩:"+s[i].getenglishiscore());
System.out.println(" 计算机网络成绩:"+s[i].getnetworkscore());
System.out.println(" 数据库成绩:"+s[i].getdatabasescore());
System.out.println(" 软件工程成绩:"+s[i].getsoftwarescore());
System.out.println("****************************************************");
System.out.println(" 该学生成绩已录入完毕,是否提交(Y/N)");
String c=sc.next();
if(c.equals("Y"))
{
t=1;
break;
}
else
{
s[i].setmathematicsscore(0);
s[i].setenglishiscore(0);
s[i].setnetworkscore(0);
s[i].setdatabasescore(0);
s[i].setsoftwarescore(0);
break;
}
}
else {t=0;break;}
}
else {t=0;break;}
}
else {t=0;break;}

}
else {t=0;break;}
}
}
else if(i==n-1)System.out.println("该学号不存在");
}
if(t==1)break;
}
}
public static void xiuga()
{
while(true)
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 请输入学生学号:********");
System.out.println("****************************************************");
String a=sc.next();
int i;
int m=0;

for(i=0;i<n;i++)
{
if(a.equals(s[i].getstunumber()))
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 1.高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 2.大学英语成绩:"+s[i].getenglishiscore());
System.out.println(" 3.计算机网络成绩:"+s[i].getnetworkscore());
System.out.println(" 4.数据库成绩:"+s[i].getdatabasescore());
System.out.println(" 5.软件工程成绩:"+s[i].getsoftwarescore());
System.out.println("****************************************************");
double x1,x2,x3,x4,x5;
x1=s[i].getmathematicsscore();
x2=s[i].getenglishiscore();
x3=s[i].getnetworkscore();
x4=s[i].getdatabasescore();
x5=s[i].getsoftwarescore();
System.out.println("请输入要修改的科目:");
int t;
t=sc.nextInt();
switch(t)
{
case 1:
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 请输入修改后的高等数学成绩:");
s[i].setmathematicsscore(sc.nextDouble());
break;
case 2:
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 请输入修改后的大学英语成绩:");
s[i].setenglishiscore(sc.nextDouble());
break;
case 3:
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 请输入修改后的计算机网络成绩:");
s[i].setnetworkscore(sc.nextDouble());
break;

case 4:
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 请输入修改后数据库的成绩:");
s[i].setdatabasescore(sc.nextDouble());
break;
case 5:
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 请输入修改后软件工程的成绩:");
s[i].setsoftwarescore(sc.nextDouble());
break;
}
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩修改界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 1.高等数学成绩:"+s[i].getmathematicsscore());
System.out.println(" 2.大学英语成绩:"+s[i].getenglishiscore());
System.out.println(" 3.计算机网络成绩:"+s[i].getnetworkscore());
System.out.println(" 4.数据库成绩:"+s[i].getdatabasescore());
System.out.println(" 5.软件工程成绩:"+s[i].getsoftwarescore());
System.out.println(" 该同学成绩已经修改完毕,是否提交(Y/N)");
System.out.println("****************************************************");
String n=sc.next();
if(n.equals("Y")){m=1;break;}
else
{
s[i].setmathematicsscore(x1);
s[i].setenglishiscore(x2);
s[i].setnetworkscore(x3);
s[i].setdatabasescore(x4);
s[i].setsoftwarescore(x5);
break;
}
}
else if(i==n-1)
{
System.out.println("该学号不存在");
}
}
if(m==1)break;
}
}
public static void jisuan()
{
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 计算学生成绩绩点计算界面 ");
System.out.println("****************************************************");
System.out.println(" 请输入学生学号:XXXXXXXX");
System.out.println("****************************************************");
Scanner shuru = null;
String a=shuru.next();
double mathematicspoint=0;
double englishpoint=0;
double networkpoint=0;
double databasepoint=0;
double softwarepoint=0;
double allpoint=0;
for(int i=0;i<100;i++)
{
if(a.equals(s[i].getstunumber()))
{
if(s[i].getmathematicsscore()<60)
{
mathematicspoint=0;
}
else if(s[i].getmathematicsscore()>60&&s[i].getmathematicsscore()<63.9)
{
mathematicspoint=1.0;
}
else if(s[i].getmathematicsscore()>64&&s[i].getmathematicsscore()<65.9)
{
mathematicspoint=1.5;
}
else if(s[i].getmathematicsscore()>66&&s[i].getmathematicsscore()<67.9)
{
mathematicspoint=1.7;
}
else if(s[i].getmathematicsscore()>68&&s[i].getmathematicsscore()<71.9)
{
mathematicspoint=2.0;
}
else if(s[i].getmathematicsscore()>72&&s[i].getmathematicsscore()<74.9)
{
mathematicspoint=2.3;
}
else if(s[i].getmathematicsscore()>75&&s[i].getmathematicsscore()<77.9)
{
mathematicspoint=2.7;
}
else if(s[i].getmathematicsscore()>78&&s[i].getmathematicsscore()<81.9)
{
mathematicspoint=3.0;
}
else if(s[i].getmathematicsscore()>82&&s[i].getmathematicsscore()<84.9)
{
mathematicspoint=3.3;
}
else if(s[i].getmathematicsscore()>85&&s[i].getmathematicsscore()<89.9)
{
mathematicspoint=3.7;
}
else if(s[i].getmathematicsscore()>=90)
{
mathematicspoint=4.0;
}
if(s[i].getenglishiscore()<60)
{
englishpoint=0;
}
else if(s[i].getenglishiscore()>60&&s[i].getenglishiscore()<63.9)
{
englishpoint=1.0;
}
else if(s[i].getenglishiscore()>64&&s[i].getenglishiscore()<65.9)
{
englishpoint=1.5;
}
else if(s[i].getenglishiscore()>66&&s[i].getenglishiscore()<67.9)
{
englishpoint=1.7;
}
else if(s[i].getenglishiscore()>68&&s[i].getenglishiscore()<71.9)
{
englishpoint=2.0;
}
else if(s[i].getenglishiscore()>72&&s[i].getenglishiscore()<74.9)
{
englishpoint=2.3;
}
else if(s[i].getenglishiscore()>75&&s[i].getenglishiscore()<77.9)
{
englishpoint=2.7;
}
else if(s[i].getenglishiscore()>78&&s[i].getenglishiscore()<81.9)
{
englishpoint=3.0;
}
else if(s[i].getenglishiscore()>82&&s[i].getenglishiscore()<84.9)
{
englishpoint=3.3;
}
else if(s[i].getenglishiscore()>85&&s[i].getenglishiscore()<89.9)
{
englishpoint=3.7;
}
else if(s[i].getenglishiscore()>=90)
{
englishpoint=4.0;
}
if(s[i].getnetworkscore()<60)
{
networkpoint=0;
}
else if(s[i].getnetworkscore()>60&&s[i].getnetworkscore()<63.9)
{
networkpoint=1.0;
}
else if(s[i].getnetworkscore()>64&&s[i].getnetworkscore()<65.9)
{
networkpoint=1.5;
}
else if(s[i].getnetworkscore()>66&&s[i].getnetworkscore()<67.9)
{
networkpoint=1.7;
}
else if(s[i].getnetworkscore()>68&&s[i].getnetworkscore()<71.9)
{
networkpoint=2.0;
}
else if(s[i].getnetworkscore()>72&&s[i].getnetworkscore()<74.9)
{
networkpoint=2.3;
}
else if(s[i].getnetworkscore()>75&&s[i].getnetworkscore()<77.9)
{
networkpoint=2.7;
}
else if(s[i].getnetworkscore()>78&&s[i].getnetworkscore()<81.9)
{
networkpoint=3.0;
}
else if(s[i].getnetworkscore()>82&&s[i].getnetworkscore()<84.9)
{
networkpoint=3.3;
}
else if(s[i].getnetworkscore()>85&&s[i].getnetworkscore()<89.9)
{
networkpoint=3.7;
}
else if(s[i].getnetworkscore()>=90)
{
networkpoint=4.0;
}
if(s[i].getdatabasescore()<60)
{
databasepoint=0;
}
else if(s[i].getdatabasescore()>60&&s[i].getdatabasescore()<63.9)
{
databasepoint=1.0;
}
else if(s[i].getdatabasescore()>64&&s[i].getdatabasescore()<65.9)
{
databasepoint=1.5;
}
else if(s[i].getdatabasescore()>66&&s[i].getdatabasescore()<67.9)
{
databasepoint=1.7;
}
else if(s[i].getdatabasescore()>68&&s[i].getdatabasescore()<71.9)
{
databasepoint=2.0;
}
else if(s[i].getdatabasescore()>72&&s[i].getdatabasescore()<74.9)
{
databasepoint=2.3;
}
else if(s[i].getdatabasescore()>75&&s[i].getdatabasescore()<77.9)
{
databasepoint=2.7;
}
else if(s[i].getdatabasescore()>78&&s[i].getdatabasescore()<81.9)
{
databasepoint=3.0;
}
else if(s[i].getdatabasescore()>82&&s[i].getdatabasescore()<84.9)
{
databasepoint=3.3;
}
else if(s[i].getdatabasescore()>85&&s[i].getdatabasescore()<89.9)
{
databasepoint=3.7;
}
else if(s[i].getdatabasescore()>=90)
{
databasepoint=4.0;
}
if(s[i].getsoftwarescore()<60)
{
softwarepoint=0;
}
else if(s[i].getsoftwarescore()>60&&s[i].getsoftwarescore()<63.9)
{
softwarepoint=1.0;
}
else if(s[i].getsoftwarescore()>64&&s[i].getsoftwarescore()<65.9)
{
softwarepoint=1.5;
}
else if(s[i].getsoftwarescore()>66&&s[i].getsoftwarescore()<67.9)
{
softwarepoint=1.7;
}
else if(s[i].getsoftwarescore()>68&&s[i].getsoftwarescore()<71.9)
{
softwarepoint=2.0;
}
else if(s[i].getsoftwarescore()>72&&s[i].getsoftwarescore()<74.9)
{
softwarepoint=2.3;
}
else if(s[i].getsoftwarescore()>75&&s[i].getsoftwarescore()<77.9)
{
softwarepoint=2.7;
}
else if(s[i].getsoftwarescore()>78&&s[i].getsoftwarescore()<81.9)
{
softwarepoint=3.0;
}
else if(s[i].getsoftwarescore()>82&&s[i].getsoftwarescore()<84.9)
{
softwarepoint=3.3;
}
else if(s[i].getsoftwarescore()>85&&s[i].getsoftwarescore()<89.9)
{
softwarepoint=3.7;
}
else if(s[i].getsoftwarescore()>=90)
{
softwarepoint=4.0;
}
allpoint=(mathematicspoint*4+englishpoint*3+networkpoint*4+databasepoint*3+databasepoint*2)/16;

}
System.out.println("****************************************************");
System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版");
System.out.println(" 学生考试成绩录入界面");
System.out.println("****************************************************");
System.out.println(" 学生学号:"+s[i].getstunumber());
System.out.println(" 学生姓名:"+s[i].getname());
System.out.println(" 1.高等数学成绩绩点:"+mathematicspoint);
System.out.println(" 2.大学英语成绩绩点:"+englishpoint);
System.out.println(" 3.计算机网络成绩绩点:"+networkpoint);
System.out.println(" 4.数据库成绩绩点:"+databasepoint);
System.out.println(" 5.软件工程成绩绩点:"+softwarepoint);
System.out.println(" 你的平均学分绩点为:"+allpoint);
if(allpoint>2)
{
System.out.println(" 提示信息:你的学分绩点已达到毕业要求 ");
}
if(allpoint<2)
{
System.out.println(" 提示信息:你的学分绩点不满足毕业要求");
}
System.out.println(" 是否返回系统主界面:(Y/N)");
System.out.println("****************************************************");
}
String c=sc.next();
if(c.equals("Y")){meun();}
else jisuan() ;
}


public static void main(String[] args) {
// TODO Auto-generated method stub
kaishi();
while(true)
{
meun();
}

}}

开学考试学生成绩管理Java

标签:else   method   考试   class   xxxx   shp   int   return   工程   

原文地址:https://www.cnblogs.com/sunhongbin/p/11515306.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!