The project reads in a non-negative integer (1 or greater) from theuser. The user is prompted with
Question:
The project reads in a non-negative integer (1 or greater) from theuser. The user is prompted with a menu of choices. The menu is displayed repetitively until theuser chooses to quit,The menu choices are1. Enter a new number (n)2. Print the sum of odd numbers between 1 and the integer (n inclusive)3. Print the even numbers between O and the integer (n inclusive)4. Print the prime numbers between 2 and the integer (n inclusive)5. Quit the programPROGRAM PARTICULARS:? I have provided some starting code. The java file contains comments about what you need to do.When the program starts up, the user is asked for a positive integer. Using a do while loop ensureit is positive.? There must be error checking on the input integer: if it is negative or 0, the program will print anerror message and re-prompt. This process will continue until valid input is entered.? There must be error checking on the menu choice entered: if the user enters a choice not on themenu, the program will print an error message, re-display the menu and re-prompt. This processwill continue until valid input is entered. You must use a do while for this input checking? No string or array variables are allowed.? No built-in methods for integer manipulation are allowed.? No break or continue statements other than those for the switch statement.? You may use System and Scanner but NO other classes, including you can't use the Math class.
Corporate Finance
ISBN: 978-0077861759
10th edition
Authors: Stephen Ross, Randolph Westerfield, Jeffrey Jaffe