/********************************************************************* * Author: Eric Heim * Date Created: 6/14/2011 * Course: CS0007 * Description: Allows the user to enter in the scores of a user * supplied number of scores *********************************************************************/ import java.util.Scanner; public class UserSizeArray { public static void main(String[] args) { int numTests; int[] scores; Scanner keyboard = new Scanner(System.in); System.out.print("How many tests do you have? "); numTests = keyboard.nextInt(); scores = new int [numTests]; for(int i = 0; i < numTests; i++) { System.out.print("Enter test score " + (i+1) + ": "); scores[i] = keyboard.nextInt(); } System.out.println("\nThe scores you entered are:"); for(int i = 0; i < numTests; i++) { System.out.print(scores[i] + " "); } } }