<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 14,  comments - 7,  trackbacks - 0
    要求:寫一java小程序,要求輸出姓名,班級、年齡、分數、等級
    創建三個類Student,StudentText,Text具體程序為:
    package com.dr.student;

    public class Student {
        
    private String name;
        
    private String department;
        
    private int  age;
        
    private int  score;
        
    private int  level;
        
    /**
         * 
    @return the name
         
    */

        
    public String getName() {
            
    return name;
        }

        
    /**
         * 
    @param name the name to set
         
    */

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

        
    /**
         * 
    @return the department
         
    */

        
    public String getDepartment() {
            
    return department;
        }

        
    /**
         * 
    @param department the department to set
         
    */

        
    public void setDepartment(String department) {
            
    this.department = department;
        }

        
    /**
         * 
    @return the age
         
    */

        
    public int getAge() {
            
    return age;
        }

        
    /**
         * 
    @param age the age to set
         
    */

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

        
    /**
         * 
    @return the score
         
    */

        
    public int getScore() {
            
    return score;
        }

        
    /**
         * 
    @param score the score to set
         
    */

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

        
    /**
         * 
    @return the level
         
    */

        
    public int getLevel() {
            
    return level;
        }

        
    /**
         * 
    @param level the level to set
         
    */

        
    public void setLevel(int level) {
            
    this.level = level;
        }


    }

    package com.dr.student;

    public class StudentText {
        
    public static Student[] getStudent(){
       Student[] stuArr 
    = new Student[5];
       
    //##############################################
       Student stu1 = new Student();
       stu1.setName(
    "rose");
       stu1.setDepartment(
    "生命科學系");
       stu1.setScore(
    90);
       stu1.setAge(
    23);
       stu1.setLevel(
    1);
       stuArr[
    0= stu1;
       
    //#################################################
       Student stu2 = new Student();
       stu2.setName(
    "lucky");
       stu2.setDepartment(
    "計算機科學系");
       stu2.setScore(
    89);
       stu2.setAge(
    24);
       stu2.setLevel(
    2);
       stuArr[
    1= stu2;
       
    //#################################################
       Student stu3 = new Student();
       stu3.setName(
    "LiLi");
       stu3.setDepartment(
    "中文系");
       stu3.setScore(
    98);
       stu3.setAge(
    20);
       stu3.setLevel(
    3);
       stuArr[
    2= stu3;;
       
    //####################################################
       Student stu4 =new Student();
       stu4.setName(
    "mery");
       stu4.setDepartment(
    "數信系");
       stu4.setScore(
    97);
       stu4.setAge(
    23);
       stu4.setLevel(
    2);
       stuArr[
    3= stu4;
       
    //###############################################
       Student stu5 = new Student();
       stu5.setName(
    "xiaoxiao");
       stu5.setDepartment(
    "計算機科學系");
       stu5.setScore(
    99);
       stu5.setAge(
    21);
       stu5.setLevel(
    1);
       stuArr[
    4= stu5;
       
       
       
    return stuArr;
       
    }

    public static void getScore(int i){
        
        
    switch(i){
        
    case(9):{
            System.out.println(
    "等級為A");
            
    break;
        }

        
    case(8):{
            System.out.println(
    "等級為B");
            
    break;
            
        }

        
    case(7):{
            System.out.println(
    "等級為C");
            
    break;
        }

        
    case(6):{
            System.out.println(
    "等級為D");
            
    break;
        }

        
    default:{
            System.out.println(
    "等級為E");
            
    break;
        }

        }

    }
        
    }

    package com.dr.student;

    public class Test {

        
        
    public static void main(String[] args) {
            Student[] stu 
    = StudentText.getStudent();
            
    for(int i = 0;i<stu.length;i++){
                
    if(stu[i]!=null){
                    System.out.println(
    "我叫"+stu[i].getName() +stu[i].getDepartment()+ "---今年"+stu[i].getAge()+"---本次分數為"+stu[i].getScore()+"---水平為"+stu[i].getLevel());
                    
    int j = stu[i].getScore()/10;
                    StudentText.getScore(j);
                }

            }

        }


    }

    posted on 2010-10-09 08:38 迷人笑笑 閱讀(167) 評論(0)  編輯  收藏

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


    網站導航:
     
    <2010年10月>
    262728293012
    3456789
    10111213141516
    17181920212223
    24252627282930
    31123456

    常用鏈接

    留言簿(13)

    隨筆檔案

    文章檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产成人免费高清激情视频| 国产午夜精品理论片免费观看| 狼群影院在线观看免费观看直播| 中文字幕亚洲综合久久菠萝蜜| 污污免费在线观看| 成人永久免费福利视频网站| 亚洲精品第一国产综合亚AV| 免费又黄又硬又爽大片| 噜噜噜亚洲色成人网站| 久久精品国产亚洲一区二区三区 | 亚洲美女视频一区二区三区| 99久久久国产精品免费牛牛| 亚洲狠狠狠一区二区三区| 国产一卡2卡3卡4卡2021免费观看| 亚洲免费在线视频播放| 无码高潮少妇毛多水多水免费| 亚洲AV一区二区三区四区| 亚洲国产精品成人一区| 你懂的网址免费国产| 久久精品亚洲中文字幕无码麻豆| 猫咪免费人成网站在线观看| 亚洲国产欧美国产综合一区 | 国产成人免费全部网站 | 亚洲女人18毛片水真多| 一二三四在线观看免费高清中文在线观看| 亚洲乱码一区二区三区国产精品| 又粗又硬又黄又爽的免费视频| 中国一级特黄的片子免费 | 国产一区二区免费视频| 亚洲影视一区二区| 免费欧洲美女牲交视频| 国产又黄又爽胸又大免费视频 | 亚洲AV无码资源在线观看| 亚洲国产精品成人一区| 免费不卡在线观看AV| 亚洲综合一区二区三区四区五区| 亚洲国产精品人人做人人爽| 久久久国产精品福利免费| 亚洲欧美综合精品成人导航| 中文字幕久久亚洲一区 | 亚洲av永久中文无码精品|