开学第一课Java考试

Posted vvxvv

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开学第一课Java考试相关的知识,希望对你有一定的参考价值。

package moguiba;
import java.text.DecimalFormat;
import java.util.Scanner;
import moguiba.ScoreInformation;
public class nanshoua {
         static int N=0;
   static Scanner scanner=new Scanner(System.in);
      static ScoreInformation s[]=new ScoreInformation[99];
      public static void show() {
    System.out.println("*********************************************************** "+
                                  "                      石家庄铁道大学软件工程系                 "+
                                  "                       学生学籍管理系统 2019 版                 "+
                                  "*********************************************************** "+
                                  "                   1、 学生考试成绩录入                            "+
                                  "                   2、 学生考试成绩修改                            "+
                                  "                   3、 计算学生成绩绩点                            "+
                                  "                   4、 退出学籍管理系统                            "+
                                  "***********************************************************");
       int m = scanner.nextInt();
       switch (m) { // 主菜单选择
           case 1:
               add();
               break;
           case 2:
               xiugai();
               break;
           case 3:
               jidian();
               break;
           case 4:
               exi();
               break;
           default:
            System.out.println("该选项不存在");
            break;
           }
    }
  
  public static void shuju(){
   int i=0;
   for(i=0;i<5;i++)
   {
    s[i]=new ScoreInformation();
   }
     
   s[0].setStunumber("20183517");
   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].setStunumber("20186666");
     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].setStunumber("20181314");
     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].setStunumber("20189999");
     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].setStunumber("20180000");
     s[4].setName("秦穆公");
     s[4].setMathematicsscore(0);
     s[4].setEnglishiscore(0);
     s[4].setNetworkscore(0);
     s[4].setDatabasescore(0);
     s[4].setSoftwarescore(0);
     N=5; 
    }
     public static void exi() {
        System.out.println("*********************************************************** "+
                              "      谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版       "+
                              "                                            制作人:安振                                           "+
                              "***********************************************************");
           System.exit(-1);
       }      
  public static void add() {      // 录入学生信息
     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=scanner.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(scanner.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(scanner.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(scanner.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(scanner.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(scanner.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=scanner.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 xiugai()
    {
     while(true)
     {
     System.out.println("****************************************************");
     System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("               学生考试成绩修改界面");
     System.out.println("****************************************************");
     System.out.println("                请输入学生学号:");
     System.out.println("****************************************************");
     String a=scanner.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=scanner.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(scanner.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(scanner.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(scanner.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(scanner.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(scanner.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=scanner.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 jidian()
    {
     int t=0;
     double mathematicsscore=0;
     double englishiscore=0;
     double  networkscore=0;
        double databasescore=0;
     double softwarescore=0;
     DecimalFormat df=new DecimalFormat("#.00");
     double pingjun;
     System.out.println("****************************************************");
     System.out.println("     石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("             学生考试成绩绩点计算界面");
     System.out.println("****************************************************");
     System.out.println("                请输入学生学号:");
     System.out.println("****************************************************");
     String a =scanner.next();
     for(int i=0;i<N;i++)
     {
      if(a.equals(s[i].getStunumber()))
      {
       if(s[i].getMathematicsscore()>=90)mathematicsscore=4;
       else if(s[i].getMathematicsscore()>=85&&s[i].getMathematicsscore()<=89.9)mathematicsscore=3.7;
       else if(s[i].getMathematicsscore()>=82&&s[i].getMathematicsscore()<=84.9)mathematicsscore=3.3;
       else if(s[i].getMathematicsscore()>=78&&s[i].getMathematicsscore()<=81.9)mathematicsscore=3.0;
       else if(s[i].getMathematicsscore()>=75&&s[i].getMathematicsscore()<=77.9)mathematicsscore=2.7;
       else if(s[i].getMathematicsscore()>=72&&s[i].getMathematicsscore()<=74.9)mathematicsscore=2.3;
       else if(s[i].getMathematicsscore()>=68&&s[i].getMathematicsscore()<=71.9)mathematicsscore=2.0;
       else if(s[i].getMathematicsscore()>=66&&s[i].getMathematicsscore()<=67.9)mathematicsscore=1.7;
       else if(s[i].getMathematicsscore()>=64&&s[i].getMathematicsscore()<=65.9)mathematicsscore=1.5;
       else if(s[i].getMathematicsscore()>=60&&s[i].getMathematicsscore()<=63.9)mathematicsscore=1.0;
       else if(s[i].getMathematicsscore()<60)mathematicsscore=0;
       if(s[i].getEnglishiscore()>=90)mathematicsscore=4;
       else if(s[i].getEnglishiscore()>=85&&s[i].getEnglishiscore()<=89.9)englishiscore=3.7;
       else if(s[i].getEnglishiscore()>=82&&s[i].getEnglishiscore()<=84.9)englishiscore=3.3;
       else if(s[i].getEnglishiscore()>=78&&s[i].getEnglishiscore()<=81.9)englishiscore=3.0;
       else if(s[i].getEnglishiscore()>=75&&s[i].getEnglishiscore()<=77.9)englishiscore=2.7;
       else if(s[i].getEnglishiscore()>=72&&s[i].getEnglishiscore()<=74.9)englishiscore=2.3;
       else if(s[i].getEnglishiscore()>=68&&s[i].getEnglishiscore()<=71.9)englishiscore=2.0;
       else if(s[i].getEnglishiscore()>=66&&s[i].getEnglishiscore()<=67.9)englishiscore=1.7;
       else if(s[i].getEnglishiscore()>=64&&s[i].getEnglishiscore()<=65.9)englishiscore=1.5;
       else if(s[i].getEnglishiscore()>=60&&s[i].getEnglishiscore()<=63.9)englishiscore=1.0;
       else if(s[i].getEnglishiscore()<60)englishiscore=0;
       if(s[i].getNetworkscore()>=90)networkscore=4;
       else if(s[i].getNetworkscore()>=85&&s[i].getNetworkscore()<=89.9)networkscore=3.7;
       else if(s[i].getNetworkscore()>=82&&s[i].getNetworkscore()<=84.9)networkscore=3.3;
       else if(s[i].getNetworkscore()>=78&&s[i].getNetworkscore()<=81.9)networkscore=3.0;
       else if(s[i].getNetworkscore()>=75&&s[i].getNetworkscore()<=77.9)networkscore=2.7;
       else if(s[i].getNetworkscore()>=72&&s[i].getNetworkscore()<=74.9)networkscore=2.3;
       else if(s[i].getNetworkscore()>=68&&s[i].getNetworkscore()<=71.9)networkscore=2.0;
       else if(s[i].getNetworkscore()>=66&&s[i].getNetworkscore()<=67.9)networkscore=1.7;
       else if(s[i].getNetworkscore()>=64&&s[i].getNetworkscore()<=65.9)networkscore=1.5;
       else if(s[i].getNetworkscore()>=60&&s[i].getNetworkscore()<=63.9)networkscore=1.0;
       else if(s[i].getNetworkscore()<60)networkscore=0;
       if(s[i].getDatabasescore()>=90)databasescore=4;
       else if(s[i].getDatabasescore()>=85&&s[i].getDatabasescore()<=89.9)databasescore=3.7;
       else if(s[i].getDatabasescore()>=82&&s[i].getDatabasescore()<=84.9)databasescore=3.3;
       else if(s[i].getDatabasescore()>=78&&s[i].getDatabasescore()<=81.9)databasescore=3.0;
       else if(s[i].getDatabasescore()>=75&&s[i].getDatabasescore()<=77.9)databasescore=2.7;
       else if(s[i].getDatabasescore()>=72&&s[i].getDatabasescore()<=74.9)databasescore=2.3;
       else if(s[i].getDatabasescore()>=68&&s[i].getDatabasescore()<=71.9)databasescore=2.0;
       else if(s[i].getDatabasescore()>=66&&s[i].getDatabasescore()<=67.9)databasescore=1.7;
       else if(s[i].getDatabasescore()>=64&&s[i].getDatabasescore()<=65.9)databasescore=1.5;
       else if(s[i].getDatabasescore()>=60&&s[i].getDatabasescore()<=63.9)databasescore=1.0;
       else if(s[i].getDatabasescore()<60)databasescore=0;
       if(s[i].getSoftwarescore()>=90)softwarescore=4;
       else if(s[i].getSoftwarescore()>=85&&s[i].getSoftwarescore()<=89.9)softwarescore=3.7;
       else if(s[i].getSoftwarescore()>=82&&s[i].getSoftwarescore()<=84.9)softwarescore=3.3;
       else if(s[i].getSoftwarescore()>=78&&s[i].getSoftwarescore()<=81.9)softwarescore=3.0;
       else if(s[i].getSoftwarescore()>=75&&s[i].getSoftwarescore()<=77.9)softwarescore=2.7;
       else if(s[i].getSoftwarescore()>=72&&s[i].getSoftwarescore()<=74.9)softwarescore=2.3;
       else if(s[i].getSoftwarescore()>=68&&s[i].getSoftwarescore()<=71.9)softwarescore=2.0;
       else if(s[i].getSoftwarescore()>=66&&s[i].getSoftwarescore()<=67.9)softwarescore=1.7;
       else if(s[i].getSoftwarescore()>=64&&s[i].getSoftwarescore()<=65.9)softwarescore=1.5;
       else if(s[i].getSoftwarescore()>=60&&s[i].getSoftwarescore()<=63.9)softwarescore=1.0;
       else if(s[i].getSoftwarescore()<60)softwarescore=0;
       pingjun=(4*s[i].getMathematicsscore()+3*s[i].getEnglishiscore()+4*s[i].getNetworkscore()+3*s[i].getDatabasescore()+2*s[i].getSoftwarescore())/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.高等数学绩点:"+mathematicsscore);
       System.out.println("                 2.大学英语绩点:"+englishiscore);
       System.out.println("                 3.计算机网络绩点:"+networkscore);
       System.out.println("                 4.数据库绩点:"+databasescore);
       System.out.println("                 5.软件工程绩点:"+softwarescore);
       System.out.println("                  你的平均学分绩点为:"+df.format(pingjun));
       if(pingjun>=2)System.out.println("       你的学分绩点已达到毕业要求!"  );
       else System.out.println("           你的学分绩点不满足毕业要求!" );
       System.out.println("          是否返回系统主界面:(Y/N)");
       System.out.println("****************************************************");
       String c=scanner.next();
       if(c.equals("Y")){t=1;break;}
       else break;
      }
      else if(i==N-1)System.out.println("该学号不存在");
     }
     if(t==1) show();
    }

 public static void main(String[] args) {
                    shuju();
     while(true)
     {
      show();
     }
 }
}
 
 
————————————————————————
 ***********以下是ScoreInformation类。******************
————————————————————————
 
 
package moguiba;
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 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 getDatabasescore() {
  return databasescore;
 }
 public void setDatabasescore(double databasescore) {
  this.databasescore=databasescore;
 }
 public double getSoftwarescore() {
  return softwarescore;
 }
 public void setSoftwarescore(double softwarescore) {
  this.softwarescore=softwarescore;
 }
 public String toString() {
  return "学号:"+stunumber+" |"+"姓名:"+name+" |"+"高等数学:"+mathematicsscore+" |"+"大学英语:"+englishiscore+" |"+"计算机网络:"+networkscore+" |"+"数据库:"+databasescore+" |"+"软件工程:"+softwarescore+" |";
 }
 public static void main(String[] args) {
 }
}

以上是关于开学第一课Java考试的主要内容,如果未能解决你的问题,请参考以下文章

《开学第一课》观后感—吕中琪

开学第一课

java开学第一周测试自我感想

java开学考试有感以及源码

全栈软件测试能力培养

高中最后一刻&大学第一课&为人师的责任