home *** CD-ROM | disk | FTP | other *** search
- class App1_2 {
- public static void main(String[] args) {
- int nMonth = Integer.parseInt(args[0]);
- int nDay = Integer.parseInt(args[1]);
- int nYear = Integer.parseInt(args[2]);
- int nDayInYear = 0;
-
- for(int nM = 1; nM < nMonth; ++nM) {
- switch (nM) {
- case 2:
- nDayInYear += 28;
- if (nYear % 4 == 0 && nYear % 100 != 0) {
- ++nDayInYear;
- }
- break;
- case 4:
- case 6:
- case 9:
- case 11:
- nDayInYear += 30;
- break;
- default:
- nDayInYear += 31;
- }
- }
-
- nDayInYear += nDay;
- System.out.print(nMonth + "-" + nDay + "-" + nYear);
- System.out.println(" is day number " + nDayInYear + " in the year");
- }
- }
-