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)

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 临清市| 浠水县| 西藏| 中江县| 睢宁县| 涿州市| 银川市| 康平县| 蒙山县| 班玛县| 绥芬河市| 南郑县| 东城区| 苍南县| 会同县| 新营市| 四子王旗| 舞阳县| 固镇县| 合山市| 许昌县| 西峡县| 鸡西市| 德惠市| 子长县| 彩票| 微博| 大足县| 竹山县| 开原市| 城固县| 绍兴市| 久治县| 休宁县| 澜沧| 东辽县| 都昌县| 镇平县| 安化县| 闵行区| 余江县|