import java.util.Scanner;
public class Demo1
{
public static void main(String[] args)
{
Scanner reply = new Scanner(System.in);
final int sizeOfArray = 25;
int [ ] grades = new int [sizeOfArray];
int total = 0;
// Fill the array
for (int i = 0; i < sizeOfArray; i++)
{
System.out.println("Please enter
grade: ");
grades[i] = reply.nextInt();
total += grades[i];
}
// Print the array
for (int i = 0; i < sizeOfArray; i++)
{
System.out.println(grades[i]);
}
|
What is the advantage of using a CONSTANT (final) to represent the size of the array?
|
What is the purpose of the counter total ?
|
What is the purpose of using a cast to (double) for finding the average?
|
|