我需要一些幫助才能開始使用我的Java課程的代碼(我不得不錯過本週,如果沒有他們學到的東西,我會很無奈),並且很感激任何有關我正在做。我的目標是創建一個基於輸入計算成績的代碼。構建評分課程的Java代碼
下面是最終應該是什麼樣子的運行:
請輸入你想計算的平均分,最低得分和得分最高的課程數目:2
請輸入課程名稱:CSC 201
請輸入一個分數CSC 201或類型-1,表明有這門課程沒有更多的分數:
*輸入各種這裏值*課程名稱:CSC 201
數得分:2
平均得分:80.0
的最低分數:70
最高得分:90
我只是...不太確定去哪裏。我的基本代碼如下,我只是不知道該怎麼做,甚至不知道如何使用Math.min和Math.max。感謝您提供關於如何離開這裏的想法的任何幫助!
import java.util.Scanner;
public class GradeCalc {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Please enter the number of courses that you would like to ");
System.out.println("calculate the Average Score, the Minimum Score, and the Maximum Score: ");
int status = input.nextInt();
// I am stuck here...
//
// > Math.min()
// > Math.max()
}
}
當您有一個函數並且不知道它做了什麼時,請查找它的javadoc:http://docs.oracle.com /javase/7/docs/api/java/lang/Math.html#max(int,%20int) – 2014-09-27 02:11:37