Question: Your Java program will perform the following tasks: Allow user to input a string from the keyboard: The string might contain white space. Call a

Your Java program will perform the following tasks:

  • Allow user to input a string from the keyboard:
    • The string might contain white space.
  • Call a recursive method that returns a modified copy of the string input:
    • In this copy upper-case characters will be replaced with lower-case and lower-case characters will be replaced with upper-case.
      • Characters that are not alphabetic will remain unchanged.
  • After returning to main(), the program will print out the original string input and the modified version of the string input.
    • Be sure that the recursive method is called before the original string is printed; this shows that the original string has not been modified by the recursive method.

A run of the program might look like the following:

Notes:

  • The original string is not modified; the recursive method returns a new version of the string.
    • Notice that after the call to the recursive method both the original string and the modified version are printed.
      • When printing these two versions, be sure they line up vertically (as in the example run) so it is easy for the user to see that the characters have been modified correctly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!