// Bob Myers // File: switch1.java // // This is syntactically correct -- but logically wrong (missing break // statements import java.util.Scanner; public class Switch1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int score; char grade; System.out.print("\nPlease enter test grade: "); score = input.nextInt(); switch (score / 10) { case 10: // score is 100 - 109 grade = 'A'; case 9: // score is 90 - 99 grade = 'A'; case 8: // score is 80 - 89 grade = 'B'; case 7: // score is 70 - 79 grade = 'C'; case 6: // score is 60 - 69 grade = 'D'; default: grade = 'F'; // anything below 60 flunks } System.out.println("\nStudent grade = " + grade); } }