I just wanna be able to input 10 integer numbers, display the numbers, then be able to modify a specific number I have already entered, then display the new updated numbers again.
//Date: 4/6/2010
import java.io.*;
public class EnterNumbers
{
public static void main(String[] args) throws IOException
{
BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));
int[] intValue = new int[10];
String[] numbers = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"};
for (int i = 0; i < intValue.length; ++i)
{
System.out.println("Enter the " + numbers[i] + " number");
intValue[i] = Integer.valueOf(dataIn.readLine());
}
System.out.println("The numbers you entered are ");
for (int x = 0; x < intValue.length; ++x)
if (intValue[x] == intValue[9])
System.out.print(intValue[x]);
else
System.out.print(intValue[x] + ", ");
System.out.println("\nWould you like to modify a number you entered?");
char yesno = (char)System.in.read();
if (yesno == 'Y' || yesno == 'y')
{
System.out.println("Out of the 10 numbers you entered, which number do you wanna modify? (1-10)");
int input = Integer.parseInt(dataIn.readLine());
for (int x = 0; x < intValue.length; ++x)
if (input == intValue[x])
{
System.out.println("What do you want to change the number to?");
int number = Integer.parseInt(dataIn.readLine());
for (int n = 0; n < intValue.length; ++n)
if (number == intValue[x])
System.out.print(intValue[x]);
}
}
else
System.exit(0);
}
}
What am I missing??