隨筆 - 20  文章 - 57  trackbacks - 0
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          51CTO

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          ——————————
          package package_1;
          ——————————
          package package_1;
           
          public class TextMyClass_1 {
           public static void main(String[] args){
              int[] A = new int[10];//存放成績?yōu)锳的學(xué)生在數(shù)組stud中的下表
              int[] B = new int[10];
              int[] C = new int[10];
              int[] D = new int[10];
              int[] E = new int[10];
             
              Student[] stud = new Student[9];   
              Student student1=new Student();
           student1.setName("張三");
           student1.setAge(22);
           student1.setClassroom("計(jì)算機(jī)3班");
           student1.setSocre(98);
           student1.setSex("爺們");
           stud[0]=student1;
           
           Student student2=new Student();
           student2.setName("李四");
           student2.setAge(22);
           student2.setClassroom("計(jì)算機(jī)3班");
           student2.setSocre(80);
           student2.setSex("爺們");
           stud[1]=student2;
           
           Student student3=new Student();
           student3.setName("王五");
           student3.setAge(22);
           student3.setClassroom("計(jì)算機(jī)3班");
           student3.setSocre(95);
           student3.setSex("爺們");;
           stud[2]=student3;
           
           Student student4=new Student();
           student4.setName("趙六");
           student4.setAge(22);
           student4.setClassroom("計(jì)算機(jī)3班");
           student4.setSocre(89);
           student4.setSex("女的");
           stud[3]=student4;
           
           Student student5=new Student();
           student5.setName("盡可");
           student5.setAge(23);
           student5.setClassroom("計(jì)算機(jī)3班");
           student5.setSocre(78);
           student5.setSex("爺們");
           stud[4]=student5;
           
           Student student6=new Student();
           student6.setName("女女");
           student6.setAge(22);
           student6.setClassroom("計(jì)算機(jī)3班");
           student6.setSocre(88);
           student6.setSex("女的");
           stud[5]=student6;
           
           Student student7=new Student();
           student7.setName("男男");
           student7.setAge(22);
           student7.setClassroom("計(jì)算機(jī)3班");
           student7.setSocre(60);
           student7.setSex("男的");
           stud[6]=student7;
             
           Student student8=new Student();
           student8.setName("魚魚");
           student8.setAge(22);
           student8.setClassroom("計(jì)算機(jī)3班");
           student8.setSocre(70);
           student8.setSex("男的");
           stud[7]=student8;
           
           Student student9=new Student();
           student9.setName("二勝");
           student9.setAge(25);
           student9.setClassroom("計(jì)算機(jī)3班");
           student9.setSocre(40);
           student9.setSex("男的");
           stud[8]=student9;
           int aa=0,bb=0,cc=0,dd=0,ee=0;
           for(int i=0;i<stud.length;i++){
            int pp;
            pp = stud[i].socre/10;
            switch(pp){
            case 9 : {
             A[aa]=i;
             aa++;
             break;
            }
            case 8 : {
             B[bb]=i;
             bb++;
             break;
            }
            case 7 : {
             C[cc]=i;
             cc++;
             break;
            }
            case 6 : {
             D[dd]=i;
             dd++;
             break;
            }
            case 5 : ;
            case 4 : ;
            case 3 : ;
            case 2 : ;
            case 1 : ;
            case 0 :{
             E[ee]=i;
             ee++;
             break;
            }
            }
           }
           System.out.println("成績?yōu)锳的同學(xué)一共有"+aa+"人");
           System.out.println("成績?yōu)锽的同學(xué)一共有"+bb+"人");
           System.out.println("成績?yōu)镃的同學(xué)一共有"+cc+"人");
           System.out.println("成績是A的同學(xué)是:");
           for(int g=0;g<aa;g++){
           System.out.println("       " + stud[A[g]].classroom + "的" + stud[A[g]].name);
           }
           System.out.println("成績是B的同學(xué)是:");
           for(int g=0;g<bb;g++){
           System.out.println("       " + stud[B[g]].classroom + "的" + stud[B[g]].name);
           }
           System.out.println("成績是C的同學(xué)是:");
           for(int g=0;g<cc;g++){
           System.out.println("       " + stud[C[g]].classroom + "的" + stud[C[g]].name);
           }
           System.out.println("成績是D的同學(xué)是:");
           for(int g=0;g<dd;g++){
           System.out.println("       " + stud[D[g]].classroom + "的" + stud[D[g]].name);
           }
           System.out.println("成績不及格的同學(xué)是:");
           for(int g=0;g<ee;g++){
           System.out.println("       " + stud[E[g]].classroom + "的" + stud[E[g]].name);
           }
           }
          }
           
           
           
           
          ————————————————————
          package package_1;
          ————————————————————
           
          package package_1;
          public class MyClass_1 {
           //public static void main(String[] args){
            
           //}
          }
          class Student{
           public String name;
           public int age;
           public int socre;
           public String classroom;
           public String sex;
           
           public String getName(){
            return name;
           }
           public void setName(String name){
            this.name=name;
           }
           public int getAge(){
            return age;
           }
           public void setAge(int age){
            this.age=age;
           }
           public int getSocre(){
            return socre;
           }
           public void setSocre(int socre){
            this.socre=socre;
           }
           public String getSex(){
            return sex;
           }
           public void setSex(String sex){
            this.sex=sex;
           }
           public String getClassroom(){
            return classroom;
           }
           public void setClassroom(String classroom){
            this.classroom=classroom;
           }
          }
           
          posted on 2010-10-06 20:02 tovep 閱讀(158) 評論(0)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          主頁
          主站蜘蛛池模板: 云安县| 钦州市| 敖汉旗| 峨边| 四川省| 包头市| 神农架林区| 九台市| 攀枝花市| 固原市| 临泉县| 秦安县| 财经| 曲周县| 绥化市| 法库县| 碌曲县| 商洛市| 东安县| 上栗县| 乌恰县| 北碚区| 青阳县| 于田县| 囊谦县| 宁远县| 葵青区| 栾川县| 仁布县| 社旗县| 佛坪县| 涞源县| 兴业县| 剑川县| 平乡县| 无极县| 永新县| 崇左市| 恩平市| 平武县| 沙洋县|