Pre-exercise for method exercise #9

In this exercise, you will just create a simple method with input and output parameters and call it from your main routine.

1) Create a new class TestOne with a new method add3. Add3 will add 3 to the number you give it. It has input parameters of one integer and an output parameter of one integer. Click here to see the code.

2) Add a main method to that TestOne Class. The main method has no parameters and can be empty at this point. Click here to see the code.

3) It that main method, call add3 with a parameter of 5 and put the result into a variable. Then, print the result. Click here to see the code.

4) Add a scanner to the beginning of that main method. Ask the user for a number and print it. Click here to see the code.

5) Instead of passing 5 to add3, pass the number the user just entered. Click here to see the code.

6) Create one more method to put two words together called wordMerge. It has input parameters of two strings and outputs one string. It just returns the first string plus the second string. Click here to see the code.

7) At the end of the main method,  call wordMerge with "abc" and "def" and keep the result in a variable. Then, print the result.Click here to see the code.

8) Change the main method to ask the user for one word and then another and print those words. Click here to see the code.

9) Change the main method to send the two words the user entered to wordMerge instead of the abc and def. Click here to see the code.

I am hoping that this example helps you do your exercise #9.  In that exercise, you need to ask the user for information and then call the methods you have.