что мне нужно сделать, это создать массив, который хранит все баллы и отображает числа обратно. Помогите ~~ !! Это до сих пор я придумал.имеет проблемы с 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)' Я не вижу массив OR ArrayList в коде, который вы указали. – csmckelvey
Вы также должны добавить, какая у вас проблема, и что вы ожидаете. – jnd
rightnow Я пытаюсь выяснить, как сохранить оценки в arraylist –