/*Program to accept a month using scanner class
* and display the number of days
*/
import java.util.*;
public class month
{
public static void test()
{
Scanner in=new Scanner(System.in);
System.out.println("Enter the number of month");
int choice=in.nextInt();
switch(choice)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
System.out.println("Number of days are 31 days");
break;
case 4:
case 6:
case 9:
case 11:
System.out.println("Number of days are 30 days");
break;
case 2:
System.out.println("Number of days are 28 or 29 days");
break;
default:
System.out.println("Wrong Choice");
break;
}
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.