[問題] 最終成績計算

看板java作者 (ψ(‵▽′)ψ)時間10年前 (2013/12/23 17:07), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
想要以視窗輸入成績的方式 最後跑出來可以有總平均跟標準差 但是目前寫出來的程式卻變成每輸入一筆都會跑出一次平均跟標準差 請問我應該要怎麼改? 平均與標準差部分的程式如下 count = count + 1; // 記數加 1 exam1Ave = exam1Ave / count; exam2Ave = exam2Ave / count; exam3Ave = exam3Ave / count; aveAve = aveAve / count; System.out.println("================================================================="); System.out.println("平均數 \t\t"+two.format(exam1Ave)+"\t"+two.format(exam2Ave)+"\t"+two.format(exam3Ave)+ "\t"+"\t"+two.format(aveAve)); // 算每一科的標準差 exam1Sd = Math.sqrt((exam1Sd - count*Math.pow(exam1Ave,2))/count); exam2Sd = Math.sqrt((exam2Sd - count*Math.pow(exam2Ave,2))/count); exam3Sd = Math.sqrt((exam3Sd - count*Math.pow(exam3Ave,2))/count); aveSd = Math.sqrt((aveSd - count*Math.pow(aveAve,2))/count); System.out.println("標準差 \t\t"+two.format(exam1Sd)+"\t"+two.format(exam2Sd)+"\t"+two.format(exam3Sd)+ "\t" + "\t"+two.format(aveSd)); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 120.125.56.9

12/23 17:49, , 1F
Count=3再印出來
12/23 17:49, 1F

12/23 18:02, , 2F
http://ppt.cc/r3ZA 我用出來變這樣 但我想等都輸入完
12/23 18:02, 2F

12/23 18:03, , 3F
才跑出平均那些的
12/23 18:03, 3F
文章代碼(AID): #1Ij_qx_B (java)