posts - 17,  comments - 14,  trackbacks - 0
          package gov.school.student;

          public class Student {
              
              
              
          private int stuno;
              
          private String name;
              
          private String sex;
              
          private int age;
              
          private int score;

              
          public int getStuno() {
                  
          return stuno;
              }

              
          public void setStuno(int stuno) {
                  
          this.stuno = stuno;
              }

              
          public String getName() {
                  
          return name;
              }

              
          public void setName(String name) {
                  
          this.name = name;
              }

              
          public String getSex() {
                  
          return sex;
              }

              
          public void setSex(String sex) {
                  
          this.sex = sex;
              }

              
          public int getAge() {
                  
          return age;
              }

              
          public void setAge(int age) {
                  
          this.age = age;
              }

              
          public int getScore() {
                  
          return score;
              }

              
          public void setScore(int score) {
                  
          this.score = score;
              }


          }

          package gov.school.student;

          public class StudentServer {
              
              
          public static Student[] getStudent()
              
          {
                  Student[] student 
          = new Student[5];
                  
                  Student st0 
          = new Student();
                  st0.setAge(
          20);
                  st0.setName(
          "老大");
                  st0.setScore(
          95);
                  st0.setSex(
          "");
                  st0.setStuno(
          1001);
                  student[
          0= st0;
                  
                  Student st1 
          = new Student();
                  st1.setAge(
          21);
                  st1.setName(
          "老二");
                  st1.setScore(
          92);
                  st1.setSex(
          "");
                  st1.setStuno(
          1002);
                  student[
          1= st1;
                  
                  Student st2 
          = new Student();
                  st2.setAge(
          22);
                  st2.setName(
          "老三");
                  st2.setScore(
          76);
                  st2.setSex(
          "");
                  st2.setStuno(
          1003);
                  student[
          2= st2;
                  
                  Student st3 
          = new Student();
                  st3.setAge(
          28);
                  st3.setName(
          "老四");
                  st3.setScore(
          60);
                  st3.setSex(
          "");
                  st3.setStuno(
          1004);
                  student[
          3= st3;
                  
                  Student st4 
          = new Student();
                  st4.setAge(
          20);
                  st4.setName(
          "老五");
                  st4.setScore(
          85);
                  st4.setSex(
          "");
                  st4.setStuno(
          1005);
                  student[
          4= st4;
                  
                  
          return student;
                  
              }


          }

          package gov.school.student;

          public class StudentClient {
              
          public static void main(String[] args)
              
          {
                  
          // TODO Auto-generated method stub
                  Student stud []=StudentServer.getStudent();
                  String level
          ="a";
                  
          int q=0,w=0,e=0,r=0,t=0;
                  
          for (int i=0;i<stud.length;i++){
                      
          if (stud[i].getScore()>90){
                          level
          ="A";
                          q
          ++;
                      }
          else if(stud[ i].getScore()>80){
                          level
          ="B";
                          w
          ++;
                      }
          else if(stud[ i].getScore()>70){
                          level
          ="C";
                          e
          ++;
                      }
          else if(stud[ i].getScore()>60){
                          level
          ="D";
                          r
          ++;
                      }
          else {
                          level
          ="E";
                      }

                  
                  System.out.println(stud[i].getName()
          +"  "+stud[i].getAge()+"歲,性別:   "+stud[i].getSex()+", 學號:"+stud[i].getStuno()+",  得分:   "+stud[i].getScore()+",   得分等級: "+level+"");
                  }

                  System.out.println(
          "\n"+"等級為  A 的人數為:"+q);
                  System.out.println(
          "等級為  B 的人數為:"+w);
                  System.out.println(
          "等級為  C 的人數為:"+e);
                  System.out.println(
          "等級為  D 的人數為:"+r);
                  System.out.println(
          "等級為  E 的人數為:"+t);

              }


          }


          運行結果:

          posted on 2010-10-10 18:21 Mineralwasser 閱讀(187) 評論(3)  編輯  收藏

          FeedBack:
          # re: student
          2010-10-10 18:33 | Tovep
          LZ寫的很好啊!   回復  更多評論
            
          # re: student
          2010-10-10 19:53 | 迷人笑笑
          很不錯啊!!前進的這么快!!呵呵--加油!!  回復  更多評論
            
          # re: student
          2010-10-10 22:41 | Mineralwasser
          謝謝@迷人笑笑
            回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(1)

          文章檔案(21)

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 睢宁县| 西安市| 宣恩县| 陈巴尔虎旗| 阜阳市| 巴楚县| 隆回县| 楚雄市| 平乡县| 丰台区| 瓦房店市| 台前县| 莒南县| 七台河市| 漳平市| 桐庐县| 哈尔滨市| 门源| 保山市| 通许县| 乳源| 中西区| 福鼎市| 泸西县| 南汇区| 兴文县| 连江县| 和平区| 青阳县| 雅安市| 克拉玛依市| 奉化市| 垫江县| 军事| 颍上县| 平阴县| 凤台县| 永定县| 靖宇县| 兰考县| 龙江县|