Traditional Culture Encyclopedia - The 24 Solar Terms - Who knows how to make a perpetual calendar with java? It is urgent to supplement specific functions. Really O(∩_∩)O Thank you, it's really urgent! This is an emergency!
Who knows how to make a perpetual calendar with java? It is urgent to supplement specific functions. Really O(∩_∩)O Thank you, it's really urgent! This is an emergency!
/**
*
*/
Packaging calendar;
Import java.util.scanner;
/**
* perpetual calendar
*
* @ Author Administrator
*
*/
Public course calendar {
/**
* @param args
*/
Public static void main(String[] args) {
Scanner input = new scanner (system. in);
System.out.print ("Please enter year:");
int year = input . nextint();
System.out.print ("Please enter month:");
int months = input . nextint();
int year num = 0;
int sum = 0;
for(int I = 1900; My< year; I++) {// year
if ((i % 4 == 0) || (i % 100! = 0 & amp& ampi % 400 == 0)) {
sum+= 366;
} Otherwise {
sum+= 365;
}
}
boolean isYear = false
If ((year% 4 == 0) || (year% 100! = 0 & amp& ampyear % 400 == 0)) {
isYear = true
}
for(int I = 1; I < = month; I++) {// month
sum+= yern um;
Switch (i) (
Case 1:
Case 3:
Case 5:
Case 7:
Case 8:
Case 10:
Case 12: {
yrenum = 3 1;
Break;
}
Case 4:
Case 6:
Case 9:
Case 1 1: {
yearNum = 30
Break;
}
Case 2: {
if (isYear) {
yearNum = 29
} Otherwise {
yearNum = 28
}
Break;
}
}
}
String[] week = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" and "Saturday"};
for(int I = 0; I< weeks. Length; i++) {
system . out . print(week[I]+" \ t ");
}
system . out . println();
for(int I = 0; I < total% 7; i++) {
system . out . print(" \ t ");
}
for(int n = 1; N< = yearumn++) {//output
if ((sum + n) % 7 == 1) {
system . out . println();
}
system . out . print(n+" \ t ");
}
}
}
- Related articles
- Should the throttle be washed or not? What is the function of the throttle?
- What does the frost mean at the beginning of this year?
- What is the custom of panic season?
- Which of the 24 solar terms is the Millennium? Brief introduction of Millennium temperature change
- The egr valve of the new car is broken. Can I ask for a change?
- Common ancient poetry solar terms
- Apart from China, which country has Arbor Day in March?
- What does it mean that a tree has two vernal equinox colors?
- Chinese medicine solar terms vocabulary
- Phenological characteristics of autumnal equinox