/* MultiwayBranch4.java CIS 160 David G. Klick 2007-09-25 Demonstrates switch statement with fall-through (purposefully missing 'break' statements). This program has an error since it doesn't consider the year when doing calculations. */ import java.util.Scanner; public class MultiwayBranch4 { public static void main(String[] args) { int days = 0; Scanner kbd = new Scanner(System.in); System.out.print("What month number is it? "); int month = kbd.nextInt(); System.out.print("Month number " + month + " is "); switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: days = 31; break; case 4: case 6: case 9: case 11: days = 30; break; case 2: days = 28; break; default: System.out.println("*Invalid month specified*"); } if (days > 0) { System.out.println(days + " days"); } } }