Two programs in Java
Not what you're looking for?
I'm trying to learn java by myself and I came across the two programs attached below, but I can't figure out how to do them.
---
4a. 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.
4b. 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.
---
Purchase this Solution
Purchase this Solution
Free BrainMass Quizzes
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
C# variables and classes
This quiz contains questions about C# classes and variables.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Basic Computer Terms
We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.