i am supposed to create a simple program that prompts the user to enter an integer and then asks the user to enter that many values stored in an array. Then they are printed out...then the order is reversed and printed again. It's working fine my only problem is when i prompt the user to "Enter x values:" the number x never changes and i cant figure that out....considering if the user enters 5 at the beginning they are supposed to be prompted to input 5 values...here is my code...
import java.util.Scanner;
public class AssignmentOne
{
/** Creates a new instance of AssignmentOne */
public static void main(
String[] args)
{
int number;
Scanner scan = new Scanner(System.in);
System.out.println("Enter an Integer: ");
number=scan.nextInt();
int[] values = new int[number];
for(int count=0; count < values.length; count++)
{
System.out.println("Enter " + (number) + " values: ");
values[count]=scan.nextInt();
}
for(int value : values)
System.out.println(value + " ");
System.out.println("The numbers in reverse order:");
for (int count = values.length-1; count >=0; count--)
System.out.println(values[count] + " ");
}
}