A good answer might be:The correct program fragment is given below. | |
Fixed ProgramHere is the corrected program. It would be OK if you put a break after the statment in the default case, but it is not needed.
Often what you really want is for several characters to select a single case. This can be done using several case statments, followed by just one list of statments. For example, here both 'y' and 'Y' select the same statement: case 'y': case 'Y': message = message + " yellow" ; break; | |
QUESTION 10:Mentally insert extra case statements into the program so that upper and lower case characters work for each color. (Or, even better: copy the program to Notepad, fix it and run it.) Click Here after you have answered the question |