*****
****
***
**
*
*
**
***
****
*****
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
the method Character.toUpperCase()
. Here is an example:
char c = 'a';
c = Character.toUpperCase(c); // create 'A', store it in c
(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.
Here is a sample run of a program using some weird Russian name as an input :-)
Please enter a string: elena MACHKASOVA
The result is: ElEnA MaChKaSoVa
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.
Math.sin
(see p. 43).
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!
You may assume that all the strings are lower-case.