看板 TTU-Transfer 關於我們 聯絡資訊
唉..... 頭好痛 昨天整晚沒睡 送我哥他新馬子(瑞士人 去機場 兩點去6點半回到家........... 剛上語文表達超想睡覺~"~ 最近用GOOGLE查到一個國小三四年級同學,會不會有點誇張XDDDDD 而且她也是鄉民 (看到來回一下啊XDD 是個台北醫學院的強者!!!! 現在程設來練吧XD class ptt { private static double pi=3.14; private static double r; //provate static double area; private ptt(double fa) { r=fa; //area=pi*r*r; } public void show() { System.out.println("area="+pi*r*r); } } public class fate { public static void main(String args) { ptt pt[]=new ptt[3]; pt[0]=new fa(1,0); pt[1]=new fa(2,0); pt[2]=new fa(3,0); } } 9-13 class CScore { private String name; private int math; private int eng; private CScore(String str,int m,int e) { name=str; math=m; eng=e; } public void mathAvg(CScore c[]) { int sum=0; for(int i=0;i<c.length;i++) sum+=c[i].math; System.out.println("The average of math is "+math"); System.out.println((double)sum/c.length); //return(double)sum/c.length; } public void mathTop(CScore c[]) { int max=c[0].math; String str=c[0].name; for(int i=0;i<c.length;i++) { if (c[i].math>max) { max=c[i].math; str=c[i].name; } } System.out.println("The top score of math is "+math"); System.out.println("The name is "+str); public void engAvg(CScore c[]) { int sum=0; for(int i=0;i<c.length;i++) sum+=c[i].eng; System.out.println("The average of english is "); System.out.println((double)sum/c.length); //return(double)sum/c.length; } public void engTop(CScore c[]) { int max=c[0].eng; String str=c[0].name; for(int i=0;i<c.length;i++) { if (c[i].eng>max) { max=c[i].eng; str=c[i].name; } } System.out.println("The top score of english is "+eng"); System.out.println("The name is "+str); public void show (CScore c[]) { System.out.println("Name"+"/t"+"Math"+"\t"+"English+"\t"); for (int i=0;i<c.lenth;i++) { System.out.println(c[i].name+"\t"+c[i].math+"\t"+c[i].neglish+"\t"); } } } puvlic class app9_13 { public static void main(String args[]) { CScore sco[]=new CScore sco[0]=new CScore("Fiona",86, 92); sco[1]=new CScore("Ryan",95, 79); sco[2]=new CScore("Ariel,81, 83); sco[0].show(score); sco[0].mathAvg(score); sco[0].matTop(score); sco[0].engTop(score); } } 幹亂掉了 幫我改到好= = 不知道抄的亂七八遭................. 會有多少錢呢 拭目以待 禾斗禾斗 幫我修^^ (遞卡 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.129.26.2
fate9243 :812XDDDDDDDDDDDDDDDD 12/19 11:58
Frank44Yu :........(無言) 12/19 15:45
Frank44Yu :騙太大了...我都沒梗可以騙.... 12/19 15:46
derekwings :你不要亂取class的名字好不好 原PO自肥 12/19 22:31
ayudomoto :有點亂= = 變數要取易懂點的名字 12/19 23:20
ayudomoto :其實我不會寫java 但看得懂XD 12/19 23:20
fate9243 :CLASS的名稱是題目定的= = 12/19 23:25
derekwings :那你可以告訴我 public class fate 是怎麼回事嗎= =? 12/20 11:29
fate9243 :那只是隨便設定CLASS= = 12/20 11:43
jungle12345 := = 12/22 02:23