Hi I am creating a program to give me the muliplication tables between 1 and 12. The assignment as I post below is complete, however I want to be able to prompt the user to enter a correct value without having to re-run the program. Any help is much appreciated...
import java.util.Scanner;
public class MultiplicationTables {
public static void main(String[] args) {
int userChoice;
int y;
int result;
Scanner input = new Scanner(System.in);
System.out.println("Please enter an integer between 1 and 12");
userChoice = input.nextInt();
{
if(userChoice== 1 && userChoice <= 12)
{
for(y =1; y<= 12; y++)
{
result = userChoice * y;
System.out.println(y +" * " + userChoice +" = " + result);
}
}
else
{
System.out.println("Please enter an integer between 1 and 12");
}
}
}
}