Java programming calculates the day of the year, and java programming calculates
You can directly copy and run it.
Package year; import java. util. week; public class year {public static void main (String [] args) {// TODO Auto-generated method stub year y = new year (); y. fun ();} public void fun () {String str = shuru (); int year = Integer. parseInt (str. split ("") [0]); int month = Integer. parseInt (str. split ("") [1]); int day = Integer. parseInt (str. split ("") [2]); jisuan (year, month, day);} private String shuru (){ System. out. print ("separated by spaces in the middle of the input year, month, and day:"); Second s = new second (System. in); return s. nextLine ();} private void jisuan (int year, int month, int day) {int I = 0; int j = 0; // if (year % 400 = 0 | year % 4 = 0 & year % 100! = 0) {switch (month) {case 12: I + = 31; case 11: I + = 30; case 10: I + = 31; case 9: I + = 30; case 8: I + = 31; case 7: I + = 31; case 6: I + = 30; case 5: I + = 31; case 4: I + = 30; case 3: I + = 31; case 2: I + = 28; case 1: I + = 31 ;} if (month = 1 | month = 3 | month = 5 | month = 7 | month = 8 | month = 10 | month = = 12) {j = 31-day; System. out. println (I-j);} else if (month = 2) {j = 28-day; System. out. println (I-j);} else {j = 30-day; System. out. println (I-j) ;}} else {switch (month) {case 12: I + = 31; case 11: I + = 30; case 10: I + = 31; case 9: I + = 30; case 8: I + = 31; case 7: I + = 31; case 6: I + = 30; case 5: I + = 31; case 4: I + = 30; case 3: I + = 31; case 2: I + = 29; case 1: I + = 31 ;} if (month = 1 | month = 3 | month = 5 | month = 7 | month = 8 | month = 10 | month = = 12) {j = 31-day; System. out. println (I-j);} else if (month = 2) {j = 28-day; System. out. println (I-j);} else {j = 30-day; System. out. println (I-j );}}}}
For example, input: 1994 3 28
Output: 88
January 1, 88th.