Question: Write a method to reverse the case of a string 1. Add a new method called reverseCase with the following format: It is a public

Write a method to reverse the case of a string

1. Add a new method called reverseCase with the following format: It is a public method, so "anyone" can call it. It is static, which means that it doesn't need an object to be called. It returns a String value to the calling function. It takes one parameter of type String.

2. Precondition: The String parameter is not equal to null.

3. Postcondition: The method returns the same String, but uppercase letters have been made lowercase and vice versa Digits and special characters should not be changed

4. You may want to use the Character wrapper class, which has methods such as isUpperCase(), isLowerCase(), toUpperCase(), and toLowerCase().

5. You must use a for or while loop to complete this method.

6. Test reverseCase in your main method.

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!