Hello guys below is the program that i need to create. I know how to do the prime number but got stuck in displaying a error message.
Plz help
A prime number is a positive integer that is evenly divisible only by 1 and itself. Thus, e.g. 2,3,5,7,11,13,17,19 are all prime numbers. A pair of numbers x and y are twin primes if x and y are prime and |x-y| = 2. In this assignment you are to write a program that generates the twin primes between 3 and some number entered by the user. Thus, your code should prompt the user for a positive integer greater than or equal to 3. If the user enters something that is not a number or not a positive integer greater than or equal to 3, then the user should be shown an error message and should be again prompted to enter a positive integer greater than or equal to 3. If, after 3 tries, the user fails to enter a positive integer greater than or equal to 3, your code should display an error message and exit. Your code should then report the twin primes between 3 and the number entered by the user. It should also report the number of twin primes between 3 and the number entered by the user. The following represents a possible run of your code:
Please enter a positive integer greater than or equal to 3
20
<3,5> <5,7> <11,13> <17,19> are twin primes between 3 and 20.
There are 4 twin prime pairs between 3 and 20.
In order to get your program to exit when the user fails to enter a correct value after 3 tries, use the follow piece of code:
System.exit(1);
At a minimum, you will need to have two methods - a main() method and an isPrime() method that has the following signature:
public static boolean isPrime(int num)