java_学生成绩管理系统

//信1805-2   20183670  王云鹏
package student;
import java.util.Scanner;
public class ScoreManagement {
static ScoreInformation[] A=new ScoreInformation[5];
    public static void main(String args[])
    {
        for(int i=0;i<5;i++)
        {
            A[i]=new ScoreInformation();
        }
        A[0].set_name("张三");A[0].set_stunumber("20183333");
        A[1].set_name("李四");A[1].set_stunumber("20184444");
        A[2].set_name("王一");A[2].set_stunumber("20181111");
        A[3].set_name("孙二");A[3].set_stunumber("20182222");
        A[4].set_name("王云鹏");A[4].set_stunumber("20183670");
        Scanner sca=new Scanner(System.in);
        JeiMian jm=new JeiMian();
        int num=4;
        do
        {
            jm.jeimian();
            num=sca.nextInt();
            switch(num)
            {
            case 1:add();break;//录入学生成绩
            case 2:alter();break;//修改学生成绩
            case 3:jisuan();break;//计算成绩绩点
            case 4:jm.exit();break;//退出系统
            default:System.out.println("!请输入正确信息!");
            }
            
        }while(num!=4);
    }
    private static void add()
    {
        

        boolean bool=false;
        do
        {
            double c,d,e,f,g;
            String a,b;
            Scanner sca=new Scanner(System.in);
            
                JeiMian.luru1();
        
                a=sca.next();
            for(int i=0;i<5;i++)
            {
                b=A[i].get_stunumber();
                if(a.equals(b))
                {
                    String str;
                    do
                    {
                        A[i].start();
                        JeiMian.luru2(A[i]);
                        System.out.print("请输入高数成绩:");
                        c=sca.nextDouble();
                        A[i].set_mathematicsscore(c);
                        JeiMian.luru2(A[i]);
                        System.out.print("请输入大学英语成绩:");
                        d=sca.nextDouble();
                        A[i].set_englishiscore(d);
                        JeiMian.luru2(A[i]);
                        System.out.print("请输入计算机网络成绩:");
                        e=sca.nextDouble();
                        A[i].set_networkscore(e);
                        JeiMian.luru2(A[i]);
                        System.out.print("请输入数据库成绩:");
                        f=sca.nextDouble();
                        A[i].set_databasescore(f);
                        JeiMian.luru2(A[i]);
                        System.out.print("请输入软件工程成绩:");
                        g=sca.nextDouble();
                        A[i].set_softwarescore(g);
                        JeiMian.luru2(A[i]);
                        str=sca.next();
                    }while(str.equals("N"));
                    bool=true;
                    break;
                }
            }
            if(bool==false)
            {
                System.out.println("!查无此人!");
            }
        }while(bool==false);
    }
    private static void alter()
    {
        boolean bool=false;
        do
        {
            String a,b;
            
            Scanner sca=new Scanner(System.in);
            JeiMian.xiugai1();
            b=sca.next();
            for(int i=0;i<5;i++)
            {
                a=A[i].get_stunumber();
                if(a.equals(b))
                {
                    String str;
                    do 
                    {
                        int x=0;
                        JeiMian.xiugai2(A[i]);
                        x=sca.nextInt();
                        JeiMian.xiugai3(A[i], x);
                        str=sca.next();
                    }while(str.equals("N"));
                    bool=true;
                    break;
                    
                }
            }
            if(bool==false)
            {
                System.out.println("!查无此人!");
            }
        }while(bool==false);
    }
    private static void jisuan()
    {
        Scanner sca=new Scanner(System.in);
        boolean bool=false;
        do
        {
            String a,b;
            JeiMian.jidian1();
            b=sca.next();
            for(int i=0;i<5;i++)
            {
                a=A[i].get_stunumber();
                if(a.equals(b))
                {
                    String str;
                    do 
                    {
                        JeiMian.jidian2(A[i]);
                        str=sca.next();
                    }while(str.equals("N"));
                    bool=true;
                    break;
                }
            }
            if(bool==false)
            {
                System.out.println("!查无此人!");
            }
        }while(bool==false);
        
    }
    
    
}
//信1805-2    20183670    王云鹏
package student;

public class ScoreInformation {
    private String stunumber;
    private String name;
    private double mathematicsscore;
    private double englishiscore;
    private double networkscore;
    private double databasescore;
    private double softwarescore;
    public ScoreInformation() {
        stunumber="";
        name="";
        mathematicsscore=-1;
        englishiscore=-1;
        networkscore=-1;
        databasescore=-1;
        softwarescore=-1;
    }
    ScoreInformation(String a,String b,double c,double d,double e,double f,double g)
    {
        stunumber=a;
        name=b;
        mathematicsscore=c;
        englishiscore=d;
        networkscore=e;
        databasescore=f;
        softwarescore=g;
    }
    public void set_stunumber(String a)
    {
        stunumber=a;
    }
    public void set_name(String b)
    {
        name=b;
    }
    public void set_mathematicsscore(double c)
    {
        mathematicsscore=c;
    }
    public void set_englishiscore(double d)
    {
        englishiscore=d;
    }
    public void set_networkscore(double e)
    {
        networkscore=e;
    }
    public void set_databasescore(double f)
    {
        databasescore=f;
    }
    public void set_softwarescore(double g)
    {
        softwarescore=g;
    }
    public String get_stunumber()
    {
        return stunumber;
    }
    public String get_name()
    {
        return name;
    }
    public double get_mathematicsscore() 
    {
        return mathematicsscore;
    }
    public double get_englishiscore() 
    {
        return englishiscore;
    }
    public double get_networkscore() 
    {
        return networkscore;
    }
    public double get_databasescore() 
    {
        return databasescore;
    }
    public double get_softwarescore() 
    {
        return softwarescore;
    }
    public void start()
    {
         mathematicsscore=-1;
         englishiscore=-1;
         networkscore=-1;
         databasescore=-1;
         softwarescore=-1;
    }
}
//信1805-2   20183670    王云鹏
package student;

import java.util.Scanner;

class JeiMian {
    JeiMian(){}

    public void exit()
    {
        System.out.println("***********************************************************");
        System.out.println("     谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
        System.out.println("                         制作人:王云鹏 ");
        System.out.println("***********************************************************");
    }
    public void jeimian()
    {
        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("***********************************************************");
    }
     public static void luru1()
     {
         System.out.println("***********************************************************");
         System.out.println("             石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
         System.out.println("                    学生考试成绩录入 ");
         System.out.println("***********************************************************");
         System.out.print("请输入学生学号: ");
         
     }
     public static void luru2(ScoreInformation S)
     {
         System.out.println("***********************************************************");
         System.out.println("        石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
         System.out.println("                   学生考试成绩录入界面 ");
         System.out.println("***********************************************************");
         System.out.println("                学生学号:"+S.get_stunumber());
         System.out.println("                 学生姓名:"+S.get_name());
         if(S.get_mathematicsscore()!=-1)
         {
             System.out.println("                高数成绩:"+S.get_mathematicsscore());
         }
         if(S.get_englishiscore()!=-1)
         {
             System.out.println("                大学英语成绩:"+S.get_englishiscore());
         }
         if(S.get_networkscore()!=-1)
         {
             System.out.println("                计算机网络成绩:"+S.get_networkscore());
         }
         if(S.get_databasescore()!=-1)
         {
             System.out.println("                数据库成绩:"+S.get_databasescore());
         }
         if(S.get_softwarescore()!=-1)
         {
             System.out.println("                软件工程成绩:"+S.get_softwarescore());
             System.out.println("            该学生成绩已录入完毕,是否提交(Y/N)");
             System.out.println("********************************************************** ");
         }
     }
     public static void xiugai()
     {
         System.out.println("***********************************************************");
         System.out.println("             石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
         System.out.println("                    学生考试成绩修改界面 ");
         System.out.println("***********************************************************");
     }

     public static void xiugai1()
     {
         JeiMian.xiugai();
         System.out.print("请输入学生学号: ");
     }
     public static void xiugai2(ScoreInformation S)
     {
         JeiMian.xiugai();
         System.out.println("                  学生学号:"+S.get_stunumber());
         System.out.println("                  学生姓名:"+S.get_name());
         System.out.println("               1 、高数成绩:"+S.get_mathematicsscore());
         System.out.println("               2、大学英语成绩:"+S.get_englishiscore());
         System.out.println("               3、 计算机网络成绩:"+S.get_networkscore());
         System.out.println("               4、 数据库成绩:"+S.get_databasescore());
         System.out.println("               5、 软件工程成绩:"+S.get_softwarescore());
         System.out.println("***********************************************************");
         System.out.print("请输入需要修改的成绩序号:");
     }
     public static void xiugai3(ScoreInformation S,int x)

     {
         Scanner sca=new Scanner(System.in);
         double c1;
         JeiMian.xiugai();
         if(x==1)
         {
             System.out.print("请输入修改后的高数成绩:");
             c1=sca.nextDouble();
             S.set_mathematicsscore(c1);
             
         }
         if(x==2)
         {
             System.out.print("请输入修改后的大学英语成绩:");
             c1=sca.nextDouble();
             S.set_englishiscore(c1);
         }
         if(x==3)
         {
             System.out.print("请输入修改后的计算机网络成绩:");
             c1=sca.nextDouble();
             S.set_networkscore(c1);
         }
         if(x==4)
         {
             System.out.print("请输入修改后的数据库成绩:");
             c1=sca.nextDouble();
             S.set_databasescore(c1);
         }
         if(x==5)
         {
             System.out.print("请输入修改后的软件工程成绩:");
             c1=sca.nextDouble();
             S.set_softwarescore(c1);
         }
         JeiMian.xiugai();
         System.out.println("                  学生学号:"+S.get_stunumber());
         System.out.println("                  学生姓名:"+S.get_name());
         System.out.println("               1 、高数成绩:"+S.get_mathematicsscore());
         System.out.println("               2、大学英语成绩:"+S.get_englishiscore());
         System.out.println("               3、 计算机网络成绩:"+S.get_networkscore());
         System.out.println("               4、 数据库成绩:"+S.get_databasescore());
         System.out.println("               5、 软件工程成绩:"+S.get_softwarescore());
         System.out.println("***********************************************************");
         System.out.println("            该学生成绩已修改完毕,是否提交(Y/N)");
         System.out.println("********************************************************** ");
     }
     public static double jidian(double c)
     {
         double c1=0;
         if(c>=75)
         {
             if(c<90)
             {
                 
                 if(c<82)
                 {
                     if(c<78)
                     {
                         c1=2.7;
                     }
                     else
                     {
                         c1=3;
                     }
                 }
                 else
                 {
                    if(c<85)
                    {
                        c1=3.3;
                    }
                    else
                    {
                        c1=3.7;
                    }
                 }
             }
             else
             {
                 c1=4;
             }
         }
         else
         {
            if(c<66)
            {
                if(c<60)
                {
                    c1=0;
                }
                else
                {
                    if(c<64)
                    {
                        c1=1;
                    }
                    else
                    {
                        c1=1.5;
                    }
                }
            }
            else
            {
                if(c<68)
                {
                    c1=1.7;
                }
                else
                {
                    if(c<72)
                    {
                        c1=2;
                    }
                    else
                    {
                        c1=2.3;
                    }
                }
            } 
         }
         return c1;
     }
     public static void jidian1()
     {
         System.out.println("***********************************************************");
         System.out.println("             石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
         System.out.println("                    学生考试成绩绩点计算界面 ");
         System.out.println("***********************************************************");
         System.out.print("                     请输入学生学号:");
     }
     public static void jidian2(ScoreInformation S)
     {
         double c1,d1,e1,f1,g1,p;
         c1=jidian(S.get_mathematicsscore());
         d1=jidian(S.get_englishiscore());
         e1=jidian(S.get_networkscore());
         f1=jidian(S.get_databasescore());
         g1=jidian(S.get_softwarescore());
         p=(c1*4+d1*3+e1*4+f1*3+g1*2)/16;
         System.out.println("***********************************************************");
         System.out.println("             石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
         System.out.println("                    学生考试成绩绩点计算界面 ");
         System.out.println("***********************************************************");
         System.out.println("                  学生学号:"+S.get_stunumber());
         System.out.println("                  学生姓名:"+S.get_name());
         System.out.println("               1 、高数成绩绩点:"+c1);
         System.out.println("               2、大学英语成绩绩点:"+d1);
         System.out.println("               3、 计算机网络成绩绩点:"+e1);
         System.out.println("               4、 数据库成绩绩点:"+f1);
         System.out.println("               5、 软件工程成绩绩点:"+g1);
         System.out.print("                   你的平均学分绩点为:");
         System.out.printf("%.2f",p);
         System.out.println();
         if(p>2)
         {
             System.out.println("            提示信息:你的学分绩点已达到毕业要求!");
         }
         else
         {
             System.out.println("            提示信息:你的学分绩点不满足毕业要求!");
         }
         System.out.print("                是否返回系统主界面:(Y/N)");
         System.out.println("***********************************************************");
     }
     
     
}

通过三个类 JeiMian(定义打印给使用者看到的界面的方法)、ScoreInformation(定义有关学生姓名、学号、成绩、以及set、get方法)、ScoreManagement(主类,有逻辑的将各种方法调用实现完整的功能)。

猜你喜欢

转载自www.cnblogs.com/wyppaa/p/11514587.html