import java.io.*;
class calendar
{
public static void main(String args[])throws IOException
{
int i,j,k,m,p=0,r,q,yy,i1,g;
String ss;
InputStreamReader x=new InputStreamReader(System.in);
BufferedReader y= new BufferedReader(x);
String s[]={" ","January","February","March","April","May","June","July","August","September","October","November","December"};
String str[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int b[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
System.out.println("ENTER THE FIRST DAY OF THE YEAR,YEAR AND MONTH");
ss=y.readLine();
yy=Integer.parseInt(y.readLine());
m=Integer.parseInt(y.readLine());
if(yy%4==0)
{
b[2]=29;
}
int ar[][]=new int[6][7];
for(i=1;i<=m;i++)
{
System.out.println("\t\t"+s[i]);
for(i1=0;i1<6;i1++)
{
for(j=0;j<7;j++)
{
ar[i1][j]=0;
}}
for(j=0;j<7;j++)
{
System.out.print(str[j]+" ");
}
System.out.println();
for(g=0;g<7;g++)
{
if(str[g].equals(ss))
{
p=g;
}}
r=1;
for(k=p;k<7;k++)
{
ar[0][k]=r;
r=r+1;
}
for(k=1;k<6;k++)
{
for(j=0;j<7;j++)
{
ar[k][j]=r;
r=r+1;
if(r>b[i])
{
break;
}
}
if(r>b[i])
{
break;
}
}
for(k=0;k<6;k++)
{
for(j=0;j<7;j++)
{
if(ar[k][j]==0)
{
System.out.print(" \t ");
}
else
{
System.out.print(ar[k][j]+" \t ");
}
}
System.out.println();
}
q=b[i]%7+p;
if(q<7)
{
p=q;
}
else
{
p=q-7;
}
}
}
}
class calendar
{
public static void main(String args[])throws IOException
{
int i,j,k,m,p=0,r,q,yy,i1,g;
String ss;
InputStreamReader x=new InputStreamReader(System.in);
BufferedReader y= new BufferedReader(x);
String s[]={" ","January","February","March","April","May","June","July","August","September","October","November","December"};
String str[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int b[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
System.out.println("ENTER THE FIRST DAY OF THE YEAR,YEAR AND MONTH");
ss=y.readLine();
yy=Integer.parseInt(y.readLine());
m=Integer.parseInt(y.readLine());
if(yy%4==0)
{
b[2]=29;
}
int ar[][]=new int[6][7];
for(i=1;i<=m;i++)
{
System.out.println("\t\t"+s[i]);
for(i1=0;i1<6;i1++)
{
for(j=0;j<7;j++)
{
ar[i1][j]=0;
}}
for(j=0;j<7;j++)
{
System.out.print(str[j]+" ");
}
System.out.println();
for(g=0;g<7;g++)
{
if(str[g].equals(ss))
{
p=g;
}}
r=1;
for(k=p;k<7;k++)
{
ar[0][k]=r;
r=r+1;
}
for(k=1;k<6;k++)
{
for(j=0;j<7;j++)
{
ar[k][j]=r;
r=r+1;
if(r>b[i])
{
break;
}
}
if(r>b[i])
{
break;
}
}
for(k=0;k<6;k++)
{
for(j=0;j<7;j++)
{
if(ar[k][j]==0)
{
System.out.print(" \t ");
}
else
{
System.out.print(ar[k][j]+" \t ");
}
}
System.out.println();
}
q=b[i]%7+p;
if(q<7)
{
p=q;
}
else
{
p=q-7;
}
}
}
}
No comments:
Post a Comment
Thank you for your comment