public class CalcAverage
{
public static void main(String[] args)
{
int numScores; // To hold the number of scores
// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
// Get the number of test scores.
System.out.print("How many test scores do you have? ");
numScores = keyboard.nextInt();
// Create an array to hold the test scores.
double[] scores = new double[numScores];
// Get the test scores and store them
// in the scores array.
for (int index = 0; index < numScores; index++)
{
System.out.print("Enter score #" +
(index + 1) + ": ");
scores[index] = keyboard.nextDouble();
}
// Create a Grader object, passing the
// scores array as an argument to the
// constructor.
Grader myGrader = new Grader(scores);
// Display the adjusted average.
System.out.println("Your adjusted average is " +
myGrader.getAverage());
// Display the lowest score.
System.out.println("Your lowest test score was " +
myGrader.getLowestScore());
试试这个它我组的演示程序,它应该帮助您得到的如何,因为它似乎那些谁真正知道该怎么做不会费心帮得到你所需要的信息的想法。对不起,我不能完全回答你的问题。
你允许使用'ArrayList'吗? – ajb
这是['ArrayList'](https://docs.oracle.com/javase/8/docs/api/index.html?java/util/ArrayList.html)的用途。 – Gendarme
谢谢你的帮助 –