For this project, you will create a recursive version of the method you created for Project 2: Double Up

Requirements:

1. Do not use a loop.

2. Create a recursive method with an int return type that accepts a number that will represent the max number for the double up. This method must be called recursively to display the double up calculation for each value between 1 and that max number, and return the total. The output will be the same as the output for Project 2. For example, if the recursive method is called and sent the max value 5, the output should be as follows:

Double up 1 = 2
Double up 2 = 4
Double up 3 = 6
Double up 4 = 8
Double up 5 = 10
Total = 30

However, if the method is called with a value greater than 20, the method should display a message like "Invalid number" and return -1.

4. The main method should call the method and pass a max value for testing.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.