Your objective is to write a program based on recursion. Your program will ask the computer
user to enter in two numbers. You will create an if-else statement that checks if one of the two
numbers is greater than 20 then the program will print out “Not in range.”

Example output:
X = 2
Y = 33
Not in range.

Else your program will execute the method “every2”.
The method will be a recursion method. Your method will compose a base case and a recursive
The base case will define if x greater y and if so return 0.

Example output:
X = 7
Y = 4

Now the whole objective of the code is to print the sum of every other 2 numbers the computer
user put in from 0 to 20. This means the program will add 2 to the x variable until it is greater
than the y, which will then stop the program because the base case has been reached.

If the computer user puts in 1 as the x and 11 as the y then your code should print out ‘36’.
Because 1 + 3 + 5 + 7 + 9 + 11 = 36.
This will be solved in the recursion case.

o Check the user input so that it is in the range of x < 20, and y < 20.
o If the variables are within range, call the “every2” method, a recursive method which will
add 2 to the x variable until it is larger than the y variable.
o Print out the results.

"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!