You may use the solution to the first two lab questions (the upper left and the lower left triangles).
***** **** *** ** * * ** *** **** *****
Hint: to convert a Java character into upper case, you need to use
Character.toUpperCase(). Here is an example:
(use Character.toLowerCase(c) to convert to lower-case). Alternatively you can create two additional strings: an upper-case version of the input string and the lower-case one and copy or print characters from those strings.
char c = 'a'; c = Character.toUpperCase(c); // create 'A', store it in c
Here is a sample run of a program using some weird Russian name as an input :-)
4 points of extra credit will be given if your program doesn't use an if/else statement inside the loop. The program must work correctly on all strings.
Please enter a string: elena MACHKASOVA
The result is: ElEnA MaChKaSoVa
Math.sin(see p. 43).
You may assume that all the strings are lower-case.
Please enter a string: apple Please enter a string: banana Please enter a string: grape Please enter a string: orange Please enter a string: kiwi kiwi comes before orange. Good bye!
The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.