-3
我需要做的是創建一個存儲所有分數並反向顯示數字的數組。幫助~~ !! 這是迄今爲止我想出的。java arraylist的問題
// wbin
import java.util.Scanner;
import java.text.DecimalFormat;
public Class ArrayPractice
{
public static void main(String[] args) {
int count = 0;
int total = 0;
final int SENTINEL = 0;
int score;
int sum;
Scanner scan = new Scanner(System.in);
System.out.println("Enter your score then Press 0 to display your average and total score. ");
System.out.println("When you are finished, Press 0");
System.out.print("Enter the first test score > ");
score = scan.nextInt();
while (score != SENTINEL)
{
total = score + total;
count++;
System.out.print("Enter the next test score > ");
score = scan.nextInt();
}
if (count != 0)
{
DecimalFormat oneDecimalPlace = new DecimalFormat("##.0");
System.out.println("\nYour Average is "
+ oneDecimalPlace.format((double) (total/count)));
System.out.println("Your Total score is " + total);
}
else
System.out.println("\nNo grades were entered");
}
}
'1)方法'ArrayList的是不一樣的東西數組,你似乎當你談論他們能夠相互交換2。 '2)'我在你提供的代碼中看不到數組或ArrayList。 – csmckelvey
您還需要添加您的問題以及您的期望。 – jnd
rightnow我想弄清楚如何將成績保存到arraylist –