zoukankan      html  css  js  c++  java
  • 一个简单的学生成绩管理系统(用JAVA实现)

    本系统总共有四个功能,1,实现学生成绩的录入,且每次录入后界面会发生更改,我这里采用的方法比较笨,直接列举出了显示的页面,我想了想应该可以用if条件限定来简化操作的。

    2.学生信息的修改,输入要修改的成绩序号,修改后会显示出来结果。

    3.学生学分绩点的计算,用函数来实现绩点计算功能最后调用,在最后会输出你的绩点是否通过。

    在前三个功能里都有是否录入的提示,选择是后会将成绩录入系统。

    4.退出系统

    在写的过程中我也遇到一些问题,但是错的都是一些很基础的错误(新手捂脸),第一个是Scanner类在循环时不能在循环体里面进行关闭操作,但之后我就没怎么关闭过Scanner。

    第二个是创建对象数组进行数组元素的赋值时,要加上数组元素对象的创建操作,比如Student temp[0]=new Student();不然会报错,我当时纠结这个问题了一下午(捂脸)。

    第三个是给字符串赋值时一般使用next(),别使用nextLine(),具体的他们的区别就是next()不会录入空格、tab、回车键,但nextLine()会,所以除非必要,在输入时一般选用next();

      1 package java3;
      2 
      3 import java.util.Scanner;
      4 
      5 public class ScoreInformation {
      6 private String stunumber,name;
      7 private double mathematicsscore,englishiscore,networkscore,databasescore,softwarescore;
      8 static ScoreInformation temp[]=new ScoreInformation[10];
      9 Scanner sr=new Scanner(System.in);
     10 public String getStunumber() {
     11     return stunumber;
     12 }
     13 public void setStunumber(String stunumber) {
     14     this.stunumber = stunumber;
     15 }
     16 public String getName() {
     17     return name;
     18 }
     19 public void setName(String name) {
     20     this.name = name;
     21 }
     22 public double getMathematicsscore() {
     23     return mathematicsscore;
     24 }
     25 public void setMathematicsscore(double mathematicsscore) {
     26     this.mathematicsscore = mathematicsscore;
     27 }
     28 public double getEnglishiscore() {
     29     return englishiscore;
     30 }
     31 public void setEnglishiscore(double englishiscore) {
     32     this.englishiscore = englishiscore;
     33 }
     34 public double getNetworkscore() {
     35     return networkscore;
     36 }
     37 public void setNetworkscore(double networkscore) {
     38     this.networkscore = networkscore;
     39 }
     40 public double getDatabasescore() {
     41     return databasescore;
     42 }
     43 public void setDatabasescore(double databasescore) {
     44     this.databasescore = databasescore;
     45 }
     46 public double getSoftwarescore() {
     47     return softwarescore;
     48 }
     49 public void setSoftwarescore(double softwarescore) {
     50     this.softwarescore = softwarescore;
     51 }
     52 void add()
     53 {
     54     for(int i=0;i<5;i++)
     55     {temp[i]=new ScoreInformation();
     56         temp[i].stunumber=sr.next();
     57         temp[i].name=sr.next();
     58     }
     59 }
     60 public void end()
     61 {
     62     System.out.println("***********************************************************");
     63     System.out.println("        谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
     64     System.out.println("                 制作人:海南之风");
     65     System.out.println("***********************************************************");
     66 }
     67 void creatScore()
     68 {    boolean c1=true;
     69     while(c1){
     70         c1=true;
     71     System.out.println("***********************************************************");
     72     System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
     73     System.out.println("                 学生考试成绩录入");
     74     System.out.println("***********************************************************");
     75     System.out.println("                 请输入学生学号:");
     76     System.out.println("***********************************************************");
     77     String num=sr.next();
     78     int a=0;
     79     for(int i=0;i<5;i++)
     80     {
     81         if(num.equals(temp[i].stunumber))
     82         {   a=1;
     83             System.out.println("***********************************************************");
     84             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
     85             System.out.println("                 学生考试成绩录入");
     86             System.out.println("***********************************************************");
     87             System.out.println("                   学生学号:"+temp[i].stunumber);
     88             System.out.println("                   学生姓名:"+temp[i].name);
     89             System.out.println("                请输入高等数学成绩:");
     90             System.out.println("***********************************************************");
     91             double math=sr.nextDouble();
     92             System.out.println("***********************************************************");
     93             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
     94             System.out.println("                 学生考试成绩录入");
     95             System.out.println("***********************************************************");
     96             System.out.println("                   学生学号:"+temp[i].stunumber);
     97             System.out.println("                   学生姓名:"+temp[i].name);
     98             System.out.println("                   高等数学成绩:"+math);
     99             System.out.println("                请输入大学英语成绩:");
    100             System.out.println("***********************************************************");
    101             double english=sr.nextDouble();
    102             System.out.println("***********************************************************");
    103             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    104             System.out.println("                 学生考试成绩录入");
    105             System.out.println("***********************************************************");
    106             System.out.println("                   学生学号:"+temp[i].stunumber);
    107             System.out.println("                   学生姓名:"+temp[i].name);
    108             System.out.println("                   高等数学成绩:"+math);
    109             System.out.println("                   大学英语成绩:"+english);
    110             System.out.println("                请输入计算机网络成绩:");
    111             System.out.println("***********************************************************");
    112             double com=sr.nextDouble();
    113             System.out.println("***********************************************************");
    114             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    115             System.out.println("                 学生考试成绩录入");
    116             System.out.println("***********************************************************");
    117             System.out.println("                   学生学号:"+temp[i].stunumber);
    118             System.out.println("                   学生姓名:"+temp[i].name);
    119             System.out.println("                   高等数学成绩:"+math);
    120             System.out.println("                   大学英语成绩:"+english);
    121             System.out.println("                   计算机网络成绩:"+com);
    122             System.out.println("                 请输入数据库成绩:");
    123             System.out.println("***********************************************************");
    124             double shuju=sr.nextDouble();
    125             System.out.println("***********************************************************");
    126             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    127             System.out.println("                 学生考试成绩录入");
    128             System.out.println("***********************************************************");
    129             System.out.println("                   学生学号:"+temp[i].stunumber);
    130             System.out.println("                   学生姓名:"+temp[i].name);
    131             System.out.println("                   高等数学成绩:"+math);
    132             System.out.println("                   大学英语成绩:"+english);
    133             System.out.println("                   计算机网络成绩:"+com);
    134             System.out.println("                   数据库成绩:"+shuju);
    135             System.out.println("                 请输入软件工程成绩:");
    136             System.out.println("***********************************************************");
    137             double software=sr.nextDouble();
    138             System.out.println("***********************************************************");
    139             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    140             System.out.println("                 学生考试成绩录入");
    141             System.out.println("***********************************************************");
    142             System.out.println("                   学生学号:"+temp[i].stunumber);
    143             System.out.println("                   学生姓名:"+temp[i].name);
    144             System.out.println("                   高等数学成绩:"+math);
    145             System.out.println("                   大学英语成绩:"+english);
    146             System.out.println("                   计算机网络成绩:"+com);
    147             System.out.println("                   数据库成绩:"+shuju);
    148             System.out.println("                   软件工程成绩:"+software);
    149             System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    150             System.out.println("***********************************************************");
    151             String g=sr.next();
    152             if(g.equals("Y"))
    153             {
    154                 temp[i].mathematicsscore=math;
    155                 temp[i].englishiscore=english;
    156                 temp[i].databasescore=com;
    157                 temp[i].networkscore=shuju;
    158                 temp[i].softwarescore=software;
    159                 System.out.println("录入完成!!!");
    160                 c1=false;
    161                 
    162             }
    163         }
    164     }
    165     if(a==0)
    166     {
    167         System.out.println("该学生不存在!!");
    168     }
    169 }
    170 }
    171 void updatScore()
    172 {boolean ai=true;
    173 while(ai){
    174     ai=true;
    175     System.out.println("***********************************************************");
    176     System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    177     System.out.println("                 学生考试成绩修改界面");
    178     System.out.println("***********************************************************");
    179     System.out.println("                 请输入学生学号:");
    180     System.out.println("***********************************************************");
    181     String num=sr.next();
    182     int a=0;
    183     String m;
    184     for(int i=0;i<5;i++)
    185     {
    186         if(num.equals(temp[i].stunumber))
    187         {
    188             System.out.println("***********************************************************");
    189             System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    190             System.out.println("                 学生考试成绩修改");
    191             System.out.println("***********************************************************");
    192             System.out.println("                 学生学号:"+temp[i].stunumber);
    193             System.out.println("                 学生姓名:"+temp[i].name);
    194             System.out.println("                 1、高等数学成绩:"+temp[i].mathematicsscore);
    195             System.out.println("                 2、 大学英语成绩:"+temp[i].englishiscore);
    196             System.out.println("                 3、计算机网络成绩:"+temp[i].databasescore);
    197             System.out.println("                 4、数据库成绩:"+temp[i].networkscore);
    198             System.out.println("                 5、软件工程成绩:"+temp[i].softwarescore);
    199             System.out.println("***********************************************************");
    200             a=1;
    201             System.out.println("请选择相应的数字键修改相应的成绩:");
    202             int b=sr.nextInt();
    203             switch(b)
    204             {
    205 
    206             case 1:
    207                 System.out.println("***********************************************************");
    208                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    209                 System.out.println("                 学生考试成绩修改");
    210                 System.out.println("***********************************************************");
    211                 System.out.println("                   学生学号:"+temp[i].stunumber);
    212                 System.out.println("                   学生姓名:"+temp[i].name);
    213                 System.out.println("                请输入修改后的高等数学成绩:");
    214                 System.out.println("***********************************************************");
    215                 double math=sr.nextDouble();
    216                 System.out.println("***********************************************************");
    217                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    218                 System.out.println("                 学生考试成绩修改");
    219                 System.out.println("***********************************************************");
    220                 System.out.println("                 学生学号:"+temp[i].stunumber);
    221                 System.out.println("                 学生姓名:"+temp[i].name);
    222                 System.out.println("                 1、高等数学成绩:"+math);
    223                 System.out.println("                 2、 大学英语成绩:"+temp[i].englishiscore);
    224                 System.out.println("                 3、计算机网络成绩:"+temp[i].databasescore);
    225                 System.out.println("                 4、数据库成绩:"+temp[i].networkscore);
    226                 System.out.println("                 5、软件工程成绩:"+temp[i].softwarescore);
    227                 System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    228                 System.out.println("***********************************************************");
    229                 m=sr.next();
    230                 if(m.equals("Y"))
    231                 {
    232                     temp[i].mathematicsscore=math;
    233                     ai=false;
    234                 }
    235                 break;
    236             case 2:
    237                 System.out.println("***********************************************************");
    238                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    239                 System.out.println("                 学生考试成绩修改");
    240                 System.out.println("***********************************************************");
    241                 System.out.println("                   学生学号:"+temp[i].stunumber);
    242                 System.out.println("                   学生姓名:"+temp[i].name);
    243                 System.out.println("                请输入修改后的英语成绩:");
    244                 System.out.println("***********************************************************");
    245                 double english=sr.nextDouble();
    246                 System.out.println("***********************************************************");
    247                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    248                 System.out.println("                 学生考试成绩修改");
    249                 System.out.println("***********************************************************");
    250                 System.out.println("                 学生学号:"+temp[i].stunumber);
    251                 System.out.println("                 学生姓名:"+temp[i].name);
    252                 System.out.println("                 1、高等数学成绩:"+temp[i].mathematicsscore);
    253                 System.out.println("                 2、 大学英语成绩:"+english);
    254                 System.out.println("                 3、计算机网络成绩:"+temp[i].databasescore);
    255                 System.out.println("                 4、数据库成绩:"+temp[i].networkscore);
    256                 System.out.println("                 5、软件工程成绩:"+temp[i].softwarescore);
    257                 System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    258                 System.out.println("***********************************************************");
    259                 m=sr.next();
    260                 if(m.equals("Y"))
    261                 {
    262                     
    263                     temp[i].englishiscore=english;
    264                     ai=false;
    265             }
    266                 break;
    267             case 3:
    268                 System.out.println("***********************************************************");
    269                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    270                 System.out.println("                 学生考试成绩修改");
    271                 System.out.println("***********************************************************");
    272                 System.out.println("                   学生学号:"+temp[i].stunumber);
    273                 System.out.println("                   学生姓名:"+temp[i].name);
    274                 System.out.println("                请输入修改后的计算机网络成绩:");
    275                 System.out.println("***********************************************************");
    276                 double com=sr.nextDouble();
    277                 System.out.println("***********************************************************");
    278                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    279                 System.out.println("                 学生考试成绩修改");
    280                 System.out.println("***********************************************************");
    281                 System.out.println("                 学生学号:"+temp[i].stunumber);
    282                 System.out.println("                 学生姓名:"+temp[i].name);
    283                 System.out.println("                 1、高等数学成绩:"+temp[i].mathematicsscore);
    284                 System.out.println("                 2、 大学英语成绩:"+temp[i].englishiscore);
    285                 System.out.println("                 3、计算机网络成绩:"+com);
    286                 System.out.println("                 4、数据库成绩:"+temp[i].networkscore);
    287                 System.out.println("                 5、软件工程成绩:"+temp[i].softwarescore);
    288                 System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    289                 System.out.println("***********************************************************");
    290                 m=sr.next();
    291                 if(m.equals("Y"))
    292                 {
    293                     temp[i].databasescore=com;
    294                     ai=false;
    295                 }
    296                 break;
    297             case 4:
    298                 System.out.println("***********************************************************");
    299                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    300                 System.out.println("                 学生考试成绩修改");
    301                 System.out.println("***********************************************************");
    302                 System.out.println("                   学生学号:"+temp[i].stunumber);
    303                 System.out.println("                   学生姓名:"+temp[i].name);
    304                 System.out.println("                请输入修改后的数据库成绩:");
    305                 System.out.println("***********************************************************");
    306                 double nextwork=sr.nextDouble();
    307                 System.out.println("***********************************************************");
    308                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    309                 System.out.println("                 学生考试成绩修改");
    310                 System.out.println("***********************************************************");
    311                 System.out.println("                 学生学号:"+temp[i].stunumber);
    312                 System.out.println("                 学生姓名:"+temp[i].name);
    313                 System.out.println("                 1、高等数学成绩:"+temp[i].mathematicsscore);
    314                 System.out.println("                 2、 大学英语成绩:"+temp[i].englishiscore);
    315                 System.out.println("                 3、计算机网络成绩:"+temp[i].databasescore);
    316                 System.out.println("                 4、数据库成绩:"+nextwork);
    317                 System.out.println("                 5、软件工程成绩:"+temp[i].softwarescore);
    318                 System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    319                 System.out.println("***********************************************************");
    320                 m=sr.next();
    321                 if(m.equals("Y"))
    322                 {
    323                     temp[i].networkscore=nextwork;
    324                     ai=false;
    325                 }
    326                 break;
    327             case 5:
    328                 System.out.println("***********************************************************");
    329                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    330                 System.out.println("                 学生考试成绩修改");
    331                 System.out.println("***********************************************************");
    332                 System.out.println("                   学生学号:"+temp[i].stunumber);
    333                 System.out.println("                   学生姓名:"+temp[i].name);
    334                 System.out.println("                请输入修改后的软件工程成绩:");
    335                 System.out.println("***********************************************************");    
    336                 double soft=sr.nextDouble();
    337                 System.out.println("***********************************************************");
    338                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    339                 System.out.println("                 学生考试成绩修改");
    340                 System.out.println("***********************************************************");
    341                 System.out.println("                 学生学号:"+temp[i].stunumber);
    342                 System.out.println("                 学生姓名:"+temp[i].name);
    343                 System.out.println("                 1、高等数学成绩:"+temp[i].mathematicsscore);
    344                 System.out.println("                 2、 大学英语成绩:"+temp[i].englishiscore);
    345                 System.out.println("                 3、计算机网络成绩:"+temp[i].databasescore);
    346                 System.out.println("                 4、数据库成绩:"+temp[i].networkscore);
    347                 System.out.println("                 5、软件工程成绩:"+soft);
    348                 System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    349                 System.out.println("***********************************************************");
    350                 m=sr.next();
    351                 if(m.equals("Y"))
    352                 {
    353                     temp[i].softwarescore=soft;
    354                     ai=false;
    355                 }
    356                 break;
    357             }
    358             
    359         }
    360         }
    361     if(a==0)
    362     {
    363         System.out.println("该学生不存在!!");
    364     }
    365   }    
    366 }
    367 double jidian(double a)
    368 {
    369     if(a<72)
    370     {
    371         if(a<64)
    372         {
    373             if(a<60)return 0;
    374             else return 1.0;
    375         }
    376         else{
    377             if(a<66)return 1.5;
    378             if(a<68&&a>=66)
    379                 return 1.7;
    380             if(a>=68)return 2.0;
    381         }
    382     }
    383     else{
    384         if(a>=82)
    385         {
    386             if(a<85)return 3.3;
    387             else if(a<90)return 3.7;
    388             else return 4.0;
    389         }
    390         else{
    391             if(a<75)return 2.3;
    392             else if(a<78)return 2.7;
    393             else return 3.0;
    394         }
    395     }
    396     return a;
    397     
    398 }
    399 void jisuan()
    400 {   boolean a1=true;
    401     while(a1){
    402         System.out.println("***********************************************************");
    403         System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    404         System.out.println("                 学生考试成绩修改界面");
    405         System.out.println("***********************************************************");
    406         System.out.println("                 请输入学生学号:");
    407         System.out.println("***********************************************************");
    408         String num=sr.next();
    409         int a=0;
    410         double aver;
    411         for(int i=0;i<5;i++)
    412         {
    413             if(num.equals(temp[i].stunumber))
    414             {
    415                 a=1;
    416                 aver=(jidian(temp[i].mathematicsscore)*4+jidian(temp[i].englishiscore)*3+jidian(temp[i].databasescore)*4+jidian(temp[i].networkscore)
    417                         *3+jidian(temp[i].softwarescore)*2)/(temp[i].mathematicsscore+temp[i].englishiscore+temp[i].databasescore+temp[i].networkscore);
    418                 System.out.println("***********************************************************");
    419                 System.out.println("       石家庄铁道大学软件工程系学生学籍管理系统 2019 版");
    420                 System.out.println("                 学生考试成绩绩点计算页面");
    421                 System.out.println("***********************************************************");
    422                 System.out.println("                 学生学号:"+temp[i].stunumber);
    423                 System.out.println("                 学生姓名:"+temp[i].name);
    424                 System.out.println("                 1、高等数学成绩绩点:"+jidian(temp[i].mathematicsscore));
    425                 System.out.println("                 2、 大学英语成绩绩点:"+jidian(temp[i].englishiscore));
    426                 System.out.println("                 3、计算机网络成绩绩点:"+jidian(temp[i].databasescore));
    427                 System.out.println("                 4、数据库成绩绩点:"+jidian(temp[i].networkscore));
    428                 System.out.println("                 5、软件工程成绩绩点:"+jidian(temp[i].softwarescore));
    429                 System.out.println("                你的平均学分绩点为:"+aver);
    430                 if(aver>=2)
    431                 {
    432                     System.out.println("你的学分绩点已达到毕业要求");
    433                 }
    434                 else{
    435                 System.out.println("你的学分绩点没有达到毕业要求 ");
    436                     }
    437                 System.out.println("                   该学生成绩已录入完毕,是否提交(Y/N)");
    438                 System.out.println("***********************************************************");
    439                 num=sr.next();
    440                 if(num.equals("Y"))
    441                 {
    442                     a1=false;
    443                 }
    444             }
    445     }
    446 }
    447 }
    448 }
     1 package java3;
     2 
     3 import java.util.Scanner;
     4 
     5 public class ScoreManagement {
     6 
     7     public static void main(String[] args) {
     8         ScoreInformation c1=new ScoreInformation();
     9         c1.add();
    10         while(true)
    11         {
    12                     System.out.println("***********************************************************");
    13                     System.out.println("         石家庄铁道大学软件工程系");
    14                     System.out.println("         学生学籍管理系统 2019 版");
    15                     System.out.println("***********************************************************");
    16                     System.out.println("         1、 学生考试成绩录入");
    17                     System.out.println("         2、 学生考试成绩修改");
    18                     System.out.println("         3、 计算学生成绩绩点");
    19                     System.out.println("         4、退出学籍管理系统");
    20                     System.out.println("**********************************************************");
    21                     Scanner sc=new Scanner(System.in);
    22                     System.out.println("         请输入你想要的功能序号:");
    23                     int a=sc.nextInt();
    24                     while(a<1||a>4)
    25                     {
    26                         System.out.println("输入有误");
    27                         break;
    28                     }
    29                     switch(a)
    30                     {
    31 
    32                     case 1:System.out.println("你选择了学生考试成绩录入");
    33                     c1.creatScore();
    34                     break;
    35                     case 2:System.out.println("你选择了学生考试成绩修改");
    36                     c1.updatScore();
    37                     break;
    38                     case 3:System.out.println("你选择了计算学生成绩绩点");
    39                     c1.jisuan();
    40                     break;
    41                     case 4:System.out.println("你选择了退出学籍管理系统");
    42                     c1.end();
    43                     return;
    44                     }
    45         }
    46     }
    47 
    48 }
  • 相关阅读:
    Running ASP.NET Applications in Debian and Ubuntu using XSP and Mono
    .net extjs 封装
    ext direct spring
    install ubuntu tweak on ubuntu lts 10.04,this software is created by zhouding
    redis cookbook
    aptana eclipse plugin install on sts
    ubuntu open folderpath on terminal
    ubuntu install pae for the 32bit system 4g limited issue
    EXT Designer 正式版延长使用脚本
    用 Vagrant 快速建立開發環境
  • 原文地址:https://www.cnblogs.com/w669399221/p/11512940.html
Copyright © 2011-2022 走看看