import java.util.Scanner; /** * Prompts the user for a month and indicates how many days are in that month. * * @author pollen */ public class DaysInMonth { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the number of a month (1-12): "); int month = in.nextInt(); String msg = "error"; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: msg = "31 days"; break; case 2: msg = "28 days"; break; case 4: case 6: case 9: case 11: msg = "30 days"; break; } System.out.println(msg); } }