 Here's a program that asks the user for a rating from 1 to 5, and then prints a message according to that rating, using an if-else if chain. Notice that the last else clause handles any rating that isn't in the range 1 to 5. When you're testing a set of integers or characters, you can use a multi-way if-else if chain, or you can use a switch statement. Z evaluates the expression following the switch. Here it's the variable rating, and then goes through the cases from beginning to end until it finds a matching one. Let's say the user entered a 3. The first case doesn't match, the rating isn't 1. Second case doesn't match, the rating isn't 2. The third case does match, and the program executes the statement or statements corresponding to the case, and the break statement takes you out of the switch, and the program proceeds with the next statements after the switch. The default case is the one that the program uses if none of the preceding cases has matched. The default case should always come last. Because it is the last choice, it doesn't need a break after it, but for consistency you might want to put one in. That's what the book we're currently using does. It's extremely important to put a break after each of the other cases. If you leave out the break, the program will fall through to the next case. If you were to enter a rating of 2, this incorrect code would print disagree and then proceed to print neutral before the break took it out of the switch statement. Some people misuse this fall through behavior in a mistaken quest for efficiency. In this code, for example, case 1 prints strongly disagree because of fall through. And cases 4 and 5 have been put in reverse order to make strongly agree come out correctly. Isn't that clever? No, this is the exact opposite of clever. The code is difficult to read, understand, and update. What if you needed to translate this program into a language where the adverb follows the verb? You'd have to rewrite everything because the clever approach would no longer work. Don't sacrifice readability for the sake of a couple of fewer lines of code. Take a direct approach that uses switch in the normal manner. A few more things to know about the switch statement. First, you can use a character variable as a switch variable. As in this program, where the character variable quality is used to determine a price. Second, there are instances when using the fall through behavior does make sense and increases readability. Here the cases for lower case letters fall through to the cases for the corresponding uppercase letters. This eliminates duplication of code without affecting readability. Third, if you have multiple statements in each case, you don't need to enclose them in braces. The next case specification will show where a case begins and ends. And that's the switch statement, which you can use as an alternative to an if-else-if chain.