use switch statement to determine how many days are in the entered month
import java.util.Scanner; /**// w w w. j a v a 2s.c o m * This program use switch statement to determine how many days are in the entered month */ public class DaysInAMonth { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("Please enter a month in number form (1-12)"); int month = keyboard.nextInt(); keyboard.close(); switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println(31); break; case 2: System.out.println(28); break; case 4: case 6: case 9: case 11: System.out.println(30); break; default: System.out.println("Not a month."); } } }