I need to ensure that a user enters a number between 10 and 100. If they do not, I want them to enter a new number. In between the asterisks is where my problem is (I think). Thanks in advance.
import java.util.Scanner;
public class Duplicate
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int[] array = new int[5];
System.out.println("Enter 5 integers between 10 and 100 (inclusive):");
for (int i = 0; i < array.length; i++)
****if ((input.nextInt() <= 100) || (input.nextInt() >= 10))
{
array[i] = input.nextInt();
}
****else { System.out.print("Please enter a number greater than 9 and less than 101."); }
for (int i = 0; i < array.length; i++)
System.out.print(array[i] + ", ");
System.out.println();
System.out.println("Unique values are: ");
for (int i = 0; i < array.length; i++) {
boolean show = true;
for (int j = 0; j < i; j++)
if (array[j] == array[i]) {
show = false;
break;
}
if (show)
System.out.print(array[i] + ", ");
}
}
}