Tuesday, August 14, 2012

Java_code : month showing


import java.util.Scanner;
public class month_show {

/**
* @param args
*/
public static void check_name_of_month(int mon){
System.out.println("=======================================================");
System.out.print("\t\t\t");
switch(mon){
case 1:System.out.println("January");break;
case 2:System.out.println("Febulary");break;
case 3:System.out.println("March");break;
case 4:System.out.println("April");break;
case 5:System.out.println("May");break;
case 6:System.out.println("June");break;
case 7:System.out.println("July");break;
case 8:System.out.println("August");break;
case 9:System.out.println("September");break;
case 10:System.out.println("Octorber");break;
case 11:System.out.println("November");break;
case 12:System.out.println("December");break;
default:System.out.print("");
}
System.out.println("=======================================================");
}
public static int count_month(int mon){
int day ;
check_name_of_month(mon);
if ( mon == 2)
day = 28;
else if (mon > 7 && mon <= 12)
if (mon%2==0)
day = 31;
else
day = 30;
else if (mon < 8 && mon > 0)
if (mon%2==0)
day = 30;
else
day = 31;
else
day = 0;
return day;
}
public static void show_month(int mon){
int day = count_month(mon);
if (day == 0){
System.out.println("INCORRECT MONTH(1-12)");
}else{
System.out.print("Sun\t");
System.out.print("Mon\t");
System.out.print("Tue\t");
System.out.print("Wed\t");
System.out.print("Thur\t");
System.out.print("Fri\t");
System.out.println("Sat\t");
int con_day ;
for (int i=1 ;i<=day;i++){
System.out.print(i+"\t");
con_day = i%7;
if(con_day==0)
System.out.println("");
}
System.out.println("\n=======================================================");
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.print("Month:");
int day = sc.nextInt();
show_month(day);
}

}

1 comment:


  1. We are considered as one of the services escort . It is very easy to book an bhopal Call Girl just call 0000000000 one of our whitefield escort will meet you directly you can get hot lady in your room at your hotel in less than an hour.

    ReplyDelete