|
|
|
@ -39,19 +39,20 @@ public class Calendar {
|
|
|
|
|
case 11: System.out.println("November " + year); numberOfDaysInMonth = 30; break;
|
|
|
|
|
case 12: System.out.println("December " + year); numberOfDaysInMonth = 31; break;
|
|
|
|
|
}
|
|
|
|
|
System.out.println("-----------------------------");
|
|
|
|
|
System.out.println("------------------------------------------");
|
|
|
|
|
System.out.println(" Sun Mon Tue Wed Thu Fri Sat");
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (i = 0; i < startDay; i++) {
|
|
|
|
|
System.out.print(" ");
|
|
|
|
|
}
|
|
|
|
|
for (i = 1; i <= numberOfDaysInMonth; i++)
|
|
|
|
|
if (i < 10) System.out.print(" " + 1);
|
|
|
|
|
else System.out.print(" " + 1);
|
|
|
|
|
for (i = 1; i <= numberOfDaysInMonth; i++) {
|
|
|
|
|
if (i < 10) System.out.print(" " + i);
|
|
|
|
|
else System.out.print(" " + i);
|
|
|
|
|
|
|
|
|
|
if ((i + startDay) % 7 == 0) {
|
|
|
|
|
System.out.println();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println();
|
|
|
|
|
System.out.println();
|
|
|
|
|
startDay = (startDay + numberOfDaysInMonth) % 7;
|
|
|
|
|