MP3
This commit is contained in:
parent
9b95ecb4c3
commit
01b7f65e7d
@ -21,7 +21,7 @@ public class Calendar {
|
|||||||
int startDay = firstDay;
|
int startDay = firstDay;
|
||||||
int numberOfDaysInMonth = 0;
|
int numberOfDaysInMonth = 0;
|
||||||
for (int month = 1; month <= 12; month++) {
|
for (int month = 1; month <= 12; month++) {
|
||||||
System.out.print(" ");
|
System.out.print(" ");
|
||||||
switch (month) {
|
switch (month) {
|
||||||
case 1: System.out.println("January " + year); numberOfDaysInMonth = 31; break;
|
case 1: System.out.println("January " + year); numberOfDaysInMonth = 31; break;
|
||||||
case 2: System.out.println("February " + year);
|
case 2: System.out.println("February " + year);
|
||||||
@ -39,19 +39,20 @@ public class Calendar {
|
|||||||
case 11: System.out.println("November " + year); numberOfDaysInMonth = 30; break;
|
case 11: System.out.println("November " + year); numberOfDaysInMonth = 30; break;
|
||||||
case 12: System.out.println("December " + year); numberOfDaysInMonth = 31; 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");
|
System.out.println(" Sun Mon Tue Wed Thu Fri Sat");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < startDay; i++) {
|
for (i = 0; i < startDay; i++) {
|
||||||
System.out.print(" ");
|
System.out.print(" ");
|
||||||
}
|
}
|
||||||
for (i = 1; i <= numberOfDaysInMonth; i++)
|
for (i = 1; i <= numberOfDaysInMonth; i++) {
|
||||||
if (i < 10) System.out.print(" " + 1);
|
if (i < 10) System.out.print(" " + i);
|
||||||
else System.out.print(" " + 1);
|
else System.out.print(" " + i);
|
||||||
|
|
||||||
if ((i + startDay) % 7 == 0) {
|
if ((i + startDay) % 7 == 0) {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println();
|
System.out.println();
|
||||||
startDay = (startDay + numberOfDaysInMonth) % 7;
|
startDay = (startDay + numberOfDaysInMonth) % 7;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user