本帖最後由 李泳霖 於 2022-9-17 13:51 編輯
1.假設老師在計算運動成績的分數時,動作佔1分,技巧佔2分,團隊表現佔3分
2.basketball的計算方式為:動作(action)+技巧(skill)+團隊表現(teamgame);
baseball的分數計算方式為:10+技巧(skill)+團隊表現(teamgame)
3.basketball及baseball各有calGrade方法
- public class JPD01 {
- public static void main(String argv[]) {
- int action = 1, skill = 2, teamgame = 3;
- System.out.println("The basketball grade is " + Basketball.calGrade(_____________________));
- System.out.println("The baseball grade is " + _______________(________________________));
- }
- }
- class Basketball {
- ...... {
- return a + s + t;
- }
- }
- class Baseball {
- ...... {
- return 10 + s + t;
- }
- }
複製代碼 |