• Java测试卷


    package com.学生管理系统;
     class ScoreInformation {
      private String stunumber;
      private String name;
      private double mathematicsscore;
      private double englishiscore;
      private double  networkscore;
      private double  datebasescore;
      private double  softwarescore;
      public String getStunumber() {return stunumber;}
      public void setStunumber(String stunumber) {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 mathematicsscore) {this.mathematicsscore=mathematicsscore;}
      public double getEnglishiscore() {return englishiscore;}
      public void setEnglishiscore(double englishiscore) {this.englishiscore=englishiscore;}
      public double getNetworkscore() {return networkscore;}
      public void setNetworkscore(double networkscore) {this.networkscore=networkscore;}
      public double getDatebasescore() {return datebasescore;}
      public void setDatebasescore(double datebasescore) {this.datebasescore=datebasescore;}
      public double getSoftwarescore() {return softwarescore;}
      public void setSoftwarescore(double softwarescore) {this.softwarescore=softwarescore;}
    }

    package com.学生管理系统;

    import java.util.Scanner;

    public class ScoreManagement {    Scanner in=new Scanner(System.in);

    public void display1() {  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 int find(String t)
    {
     int i=0,k=0;
     for(i=0;i<5;i++)
     {
      if(s[i].getStunumber().compareTo(t)==0)
      {
       k=1;
       break;
      }
     }
     if(k==0)
      return -1;
     else
      {
       return i;
      }
    }
    public void display2()
    {
     System.out.println("*******************************");
     System.out.println("石家庄铁道大学软件工程系学生学籍管理系统 2019 版   ");
     System.out.println("         学生考试成绩录入                 ");
     System.out.println("*******************************");
    }
    public void display3()
    {
     System.out.println("*******************************");
     System.out.println("谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版  ");
     System.out.println("         制作人:李梦贞                ");
     System.out.println("*******************************");
    }
    public void display4(int k)
    {
      System.out.println("*******************************");
      System.out.println("石家庄铁道大学软件工程系学生学籍管理系统 2019 版   ");
      System.out.println("         学生考试成绩录入界面                 ");
      System.out.println("*******************************");
      System.out.println("         学生学号:"+s[k].getStunumber());
      System.out.println("         学生姓名:"+s[k].getName());
    }
    static int con=0;
    static int w2=0;
    public void display5(int p)
    {
     System.out.println("*******************************");
     System.out.println("石家庄铁道大学软件工程系学生学籍管理系统 2019 版   ");
     System.out.println("         学生考试成绩录入界面                 ");
     System.out.println("*******************************");
     System.out.println("  学生学号:"+s[p].getStunumber());
     System.out.println("  学生姓名:"+s[p].getName());
     con++;
     if(s[p].getMathematicsscore()!=0)
      System.out.println("  1.高等数学成绩为:"+s[p].getMathematicsscore());
     if(s[p].getEnglishiscore()!=0)
      System.out.println("  2.大学英语成绩为:"+s[p].getEnglishiscore());
     if(s[p].getNetworkscore()!=0)
      System.out.println("  3.计算机网络成绩为:"+s[p].getNetworkscore());
     if(s[p].getDatebasescore()!=0)
      System.out.println("  4.数据库成绩为:"+s[p].getDatebasescore());
     if(con==5||w2==1)
      System.out.println("  5.软件工程成绩为:"+s[p].getSoftwarescore());
    }
    public void display6()
    {
     System.out.println("*******************************");
     System.out.println("石家庄铁道大学软件工程系学生学籍管理系统 2019 版   ");
     System.out.println("         学生考试成绩修改界面                 ");
     System.out.println("*******************************");
    }
    public void display7()
    {
     System.out.println("*******************************");
     System.out.println("石家庄铁道大学软件工程系学生学籍管理系统 2019 版   ");
     System.out.println("         学生考试成绩绩点计算界面                  ");
     System.out.println("*******************************");
    }
    static ScoreInformation []s=new  ScoreInformation[10];
     public static void main(String[] args) {
      // TODO Auto-generated method stub
      Scanner in=new Scanner(System.in);
      ScoreManagement stu=new ScoreManagement();
      boolean flag=true,flag2=true,flag3=true,flag4=true,flag5=true,flag6=true,flag7=true;
      String xuehao;
      int i,number;
      for(i=0;i<10;i++)
       s[i]=new ScoreInformation();
      s[0].setStunumber("20183723");
      s[0].setName("李梦贞");
      s[1].setStunumber("20180000");
      s[1].setName("小一");
      s[2].setStunumber("20180001");
      s[2].setName("小二");
      s[3].setStunumber("20180002");
      s[3].setName("小三");
      s[4].setStunumber("20180003");
      s[4].setName("小四");
      for(i=0;i<5;i++)
      {
       s[i].setDatebasescore(0);
       s[i].setEnglishiscore(0);
       s[i].setMathematicsscore(0);
       s[i].setNetworkscore(0);
       s[i].setSoftwarescore(0);
      }
      while(flag)
      {
       stu.display1();
       System.out.println("请选择要执行的功能序号");
       number=in.nextInt();
       if(number<1||number>4)
        System.out.println("该选项不存在");
       else
       {
        switch(number)
        {
         case 1:
         {
          while(flag2==true)
          {
           stu.display2();
           
           System.out.println("请输入学生学号:");
           xuehao=in.next();
           System.out.println("*******************************");
           if(stu.find(xuehao)==-1)
           {
            flag2=true;
            System.out.println("该不存在");
           }
           else
           {
            double m;
            String c;
            flag2=false;
            int b=stu.find(xuehao);
            while(flag7==true)
            {
             flag7=false;
             stu.display4(b);
             System.out.println("请输入高等数学成绩:");
             m=in.nextDouble();
             s[b].setMathematicsscore(m);
             stu.display5(b);
             System.out.println("请输入大学英语成绩:");
             m=in.nextDouble();
             s[b].setEnglishiscore(m);
             stu.display5(b);
             System.out.println("请输入计算机网络成绩:");
             m=in.nextDouble();
             s[b].setNetworkscore(m);
             stu.display5(b);
             System.out.println("请输入数据库成绩:");
             m=in.nextDouble();
             s[b].setDatebasescore(m);
             stu.display5(b);
             System.out.println("请输入软件工程成绩:");
             m=in.nextDouble();
             s[b].setSoftwarescore(m);
             stu.display5(b);
             System.out.println("该学生成绩已录入完毕,是否提交(Y/N) ");
             c=in.next();
             if(c.compareTo("N")==0)
             {
              flag7=true;
              s[b].setDatebasescore(0);
              s[b].setEnglishiscore(0);
              s[b].setMathematicsscore(0);
              s[b].setNetworkscore(0);
              s[b].setSoftwarescore(0);
             }
            }
           }
          }
          break;
         }
         case 2:
         {
          String q;
          while(flag3==true)
          {
           stu.display6();
           flag3=false;
           System.out.println("请输入学号:");
           q=in.next();
           System.out.println("*******************************");
           if(stu.find(q)==-1)
           {
            flag3=true;
            System.out.println("该不存在");
           }
           else
           {
            int r;
            int k=stu.find(q);
            double j;
            w2=1;
            flag3=false;
            stu.display5(k);
            System.out.println("请选择要修改的成绩序号:");
            r=in.nextInt();
            if(r==1)
            {
             String m;
             double old;
             stu.display4(k);
             old=s[k].getMathematicsscore();
             System.out.println("请输入要修改后的高等数学成绩:");
             j=in.nextDouble();
             s[k].setMathematicsscore(j);
             stu.display5(k);
             System.out.println("该学生成绩已修改完毕,是否提交(Y/N) ");
             m=in.next();
             if(m.compareTo("N")==0)
             {
              flag3=true;
              s[k].setMathematicsscore(old);
             }
            }
            else if(r==2)
            {
             String m;
             double old;
             old=s[k].getEnglishiscore();
             stu.display4(k);
             System.out.println("请输入要修改后的大学英语成绩:");
             j=in.nextDouble();
             s[k].setEnglishiscore(j);
             stu.display5(k);
             System.out.println("该学生成绩已修改完毕,是否提交(Y/N) ");
             m=in.next();
             if(m.compareTo("N")==0)
             {
              flag3=true;
              s[k].setEnglishiscore(old);
             }
            }
            else if(r==3)
            {
             String m;
             double old;
             old=s[k].getNetworkscore();
             stu.display4(k);
             System.out.println("请输入要修改后的计算机网络成绩:");
             j=in.nextDouble();
             s[k].setNetworkscore(j);
             stu.display5(k);
             System.out.println("该学生成绩已修改完毕,是否提交(Y/N) ");
             m=in.next();
             if(m.compareTo("N")==0)
             {
              flag3=true;
              s[k].setNetworkscore(old);
             }
            }
            else if(r==4)
            {
             String m;
             double old;
             old=s[k].getDatebasescore();
             stu.display4(k);
             System.out.println("请输入要修改后的数据库成绩:");
             j=in.nextDouble();
             s[k].setDatebasescore(j);
             stu.display5(k);
             System.out.println("该学生成绩已修改完毕,是否提交(Y/N) ");
             m=in.next();
             if(m.compareTo("N")==0)
             {
              flag3=true;
              s[k].setDatebasescore(old);
             }
            }
            else if(r==5)
            {
             String m;
             double old;
             old=s[k].getSoftwarescore();
             stu.display4(k);
             System.out.println("请输入要修改后的软件工程成绩:");
             j=in.nextDouble();
             s[k].setSoftwarescore(j);
             stu.display5(k);
             System.out.println("该学生成绩已修改完毕,是否提交(Y/N) ");
             m=in.next();
             if(m.compareTo("N")==0)
             {
              flag3=true;
              s[k].setSoftwarescore(old);
             }
            }
            else
            {
             System.out.println("请重新输入:");
            }
           }
          }
          break;
         }
         case 3:
         {
          String l;
          while(flag4==true)
          {
           stu.display7();
           in.nextLine();
           flag4=false;
           System.out.println("请输入学生学号:");
           l=in.nextLine();
           System.out.println("*******************************");
           if(stu.find(l)==-1)
           {
            flag4=true;
            System.out.println("该不存在");
           }
           else
           {
            int p=stu.find(l);
            double []a=new double[5];
            double []g=new double[]{4,3,4,3,2};
            double v=0;
            for(i=0;i<5;i++)
            {
             if(i==0)
             {
              if(s[p].getMathematicsscore()>=72)
              {
               if(s[p].getMathematicsscore()<=74.9)
                a[i]=2.3;
               else if(s[p].getMathematicsscore()<=77.9)
                a[i]=2.7;
               else if(s[p].getMathematicsscore()<=81.9)
                a[i]=3.0;
               else if(s[p].getMathematicsscore()<=84.9)
                a[i]=3.3;
               else if(s[p].getMathematicsscore()<=89.9)
                a[i]=3.7;
               else
                a[i]=4.0;
              }
              else
              {
               if(s[p].getMathematicsscore()>=68)
                a[i]=2.0;
               else if(s[p].getMathematicsscore()>=66)
                a[i]=1.7;
               else if(s[p].getMathematicsscore()>=64)
                a[i]=1.5;
               else if(s[p].getMathematicsscore()>=60)
                a[i]=1.0;
               else
                a[i]=0;
              } 
             }
             if(i==1)
             {
              if(s[p].getEnglishiscore()>=72)
              {
               if(s[p].getEnglishiscore()<=74.9)
                a[i]=2.3;
               else if(s[p].getEnglishiscore()<=77.9)
                a[i]=2.7;
               else if(s[p].getEnglishiscore()<=81.9)
                a[i]=3.0;
               else if(s[p].getEnglishiscore()<=84.9)
                a[i]=3.3;
               else if(s[p].getEnglishiscore()<=89.9)
                a[i]=3.7;
               else
                a[i]=4.0;
              }
              else
              {
               if(s[p].getEnglishiscore()>=68)
                a[i]=2.0;
               else if(s[p].getEnglishiscore()>=66)
                a[i]=1.7;
               else if(s[p].getEnglishiscore()>=64)
                a[i]=1.5;
               else if(s[p].getEnglishiscore()>=60)
                a[i]=1.0;
               else
                a[i]=0;
              } 
             }
             if(i==2)
             {
              if(s[p].getNetworkscore()>=72)
              {
               if(s[p].getNetworkscore()<=74.9)
                a[i]=2.3;
               else if(s[p].getNetworkscore()<=77.9)
                a[i]=2.7;
               else if(s[p].getNetworkscore()<=81.9)
                a[i]=3.0;
               else if(s[p].getNetworkscore()<=84.9)
                a[i]=3.3;
               else if(s[p].getNetworkscore()<=89.9)
                a[i]=3.7;
               else
                a[i]=4.0;
              }
              else
              {
               if(s[p].getNetworkscore()>=68)
                a[i]=2.0;
               else if(s[p].getNetworkscore()>=66)
                a[i]=1.7;
               else if(s[p].getNetworkscore()>=64)
                a[i]=1.5;
               else if(s[p].getNetworkscore()>=60)
                a[i]=1.0;
               else
                a[i]=0;
              } 
             }
             if(i==3)
             {
              if(s[p].getDatebasescore()>=72)
              {
               if(s[p].getDatebasescore()<=74.9)
                a[i]=2.3;
               else if(s[p].getDatebasescore()<=77.9)
                a[i]=2.7;
               else if(s[p].getDatebasescore()<=81.9)
                a[i]=3.0;
               else if(s[p].getDatebasescore()<=84.9)
                a[i]=3.3;
               else if(s[p].getDatebasescore()<=89.9)
                a[i]=3.7;
               else
                a[i]=4.0;
              }
              else
              {
               if(s[p].getDatebasescore()>=68)
                a[i]=2.0;
               else if(s[p].getDatebasescore()>=66)
                a[i]=1.7;
               else if(s[p].getDatebasescore()>=64)
                a[i]=1.5;
               else if(s[p].getDatebasescore()>=60)
                a[i]=1.0;
               else
                a[i]=0;
              } 
             }
             if(i==4)
             {
              if(s[p].getSoftwarescore()>=72)
              {
               if(s[p].getSoftwarescore()<=74.9)
                a[i]=2.3;
               else if(s[p].getSoftwarescore()<=77.9)
                a[i]=2.7;
               else if(s[p].getSoftwarescore()<=81.9)
                a[i]=3.0;
               else if(s[p].getSoftwarescore()<=84.9)
                a[i]=3.3;
               else if(s[p].getSoftwarescore()<=89.9)
                a[i]=3.7;
               else
                a[i]=4.0;
              }
              else
              {
               if(s[p].getSoftwarescore()>=68)
                a[i]=2.0;
               else if(s[p].getSoftwarescore()>=66)
                a[i]=1.7;
               else if(s[p].getSoftwarescore()>=64)
                a[i]=1.5;
               else if(s[p].getSoftwarescore()>=60)
                a[i]=1.0;
               else
                a[i]=0;
              } 
             }
            }
            for(i=0;i<5;i++)
             v+=a[i]*g[i];
            v=v/16;
            if(v>=2)
             flag5=true;
            else
             flag5=false;
            stu.display7();
            System.out.println("        学生学号:"+s[p].getStunumber());
            System.out.println("        学生姓名:"+s[p].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.println("   6、你的平均学分绩点为:"+String.format("%.2f",v));
            if(flag5==true)
             System.out.println("  你的学分绩点已达到毕业要求!");
            else
             System.out.println("  你的学分绩点不满足毕业要求!");
            System.out.println("   是否返回系统主界面:(Y/N) ");
            String c;
            c=in.next();
            if(c.compareTo("Y")==0)
             flag6=false;
           }
           if(flag6==false&&flag4==false)
            break;
          }
          break;
         }
         case 4:
         {
          stu.display3();
          flag=false;
          break;
         }
        }
       }
      }
      in.close();
     }
    }

  • 相关阅读:
    mysql 导入excel 或 .csv
    导出Excel
    jQuery.ajax
    在web项目中配置log4j
    数据分析入门
    jdbc的配置(更新中)
    Maven中项目的启动
    Maven中的配置文件
    Maven的插件管理
    Maven的依赖管理
  • 原文地址:https://www.cnblogs.com/dixingchen/p/11514576.html
Copyright © 2020-2023  润新知