A good answer might be:The completed program is given below. | |
Program that Handles Upper and Lower CaseThe program has also been improved by accepting input from the user. The program uses the charAt( int index ) method of the String class. This method returns a single character from a string. The first character in a string is at index 0, the next is at index 1, and so on. (Remember: a String is an object, even if it contains only one character. The charAt() method must be used here to get a char that can be used in the switch.)
| |
QUESTION 11:What would be wrong if the program were altered to something like: Click Here after you have answered the questionswitch ( lineIn ) { case "red": case "Red": message = message + " red" ; break; . . . and so on |