Reference no: EM132430563
Problem: Write a Java program with the following specifications:
1. The program should display a menu as follows:
MENU
[1] Prime or Composite
[2] All Prime Numbers
[3] Exit
Choose an option à
2. Option 1 should ask for an integer from the user and displays a corresponding comment as "Prime Number", "Composite Number", or "Neither Prime nor Composite".
3. Zero and 1 are neither prime nor composite, -1 is prime, while all other negative numbers are composite.
4. Option 2 should ask for an entry of two integers. It should determine and display all prime numbers between the two integers (including the two integers, if they are prime).
For example, if 3 and 11 are entered, the display should be:
3, 5, 7, 11
5. The program returns to the main menu after each display from the option and when an invalid input of the option is encountered.
6. Validate the option input. Only 1, 2 and 3 are acceptable, otherwise, display a message error and return to the main menu.
7. Exit option terminates the program.