Your main method should contain three calls to changecase


1. Write a program in which the main method calls a method with the heading public static char changeCase(char ch) that if ch is a lowercase letter, the method will return the corresponding uppercase letter, and if ch is a uppercase letter, the method will return the corresponding lowercase letter. If ch is not a letter, the method returns the same value of ch. Thus, for instance, changeCase('a') returns A, changeCase('B') returns b, and changeCase('3') returns 3. Note that the uppercase letters have a unicode (ascii code) value that is 32 lower than the corresponding lowercase ones.

Your main method should contain three calls to changeCase() for each case mentioned above.

2. Write a method public static char toUpperCase(char ch) that if ch is a lowercase letter, the method will return the corresponding uppercase letter, and if ch is any other character, it will return that character. Read a string consisting of "My country tis of thee, Sweet land of liberty, Of thee I sing" and using toUpperCase() in a loop, convert the entire string to uppercase letters, where the string is assigned to the variable s.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Your main method should contain three calls to changecase
Reference No:- TGS01251687

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)