감 ¶
2때 데블 때 못 다가 그 겨 기 문는데... 바 로 만 더 문가 나는데, 그 고 나 내가 그때 못 까...는 각 드는군. 밑 는 리링 가 긴 만.
그런데 바 다 만달력 구는 가 또 군. 고 나 렸.ㅎㅎ
그런데 바 다 만달력 구는 가 또 군. 고 나 렸.ㅎㅎ
드 ¶
import javax.swing.*; public class EternalCalendar { public static void main(String []args) { int[] daysOfMonth={31, 28, 31, 30, 31,30, 31, 31, 30, 31, 30, 31};//각 달 날 String[] nameOfday={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};//각 int dYear=Integer.parseInt(JOptionPane.showInputDialog(null, "고 력:", "만달력", JOptionPane.QUESTION_MESSAGE)); int dMonth=Integer.parseInt(JOptionPane.showInputDialog(null, "고 력:", "만달력", JOptionPane.QUESTION_MESSAGE)); //고 / 력 int totalDays=0;//그 까 날 for(int i=1;i<dYear;i++) { if((i%4==0 && i%100!=0) || i%400==0) totalDays+=366; else totalDays+=365; }//그 까 날 if((dYear%4==0 && dYear%100!=0) || dYear%400==0) daysOfMonth[1]=29;//력 2 달 는 for(int i=1;i<dMonth;i++)//당는 그 달까 날 totalDays+=daysOfMonth[i-1]; System.out.println(dYear+" "+dMonth+" 달력"); for(int i=0;i<7;i++)//달력 단 력 System.out.print(nameOfday[i]+"\t"); System.out.print("\n"); for(int i=0;i<(totalDays+1)%7;i++) System.out.print("\t");//당 달 날 . +1 는 1 1 1 for(int i=1;i<daysOfMonth[dMonth-1]+1;i++) {//1부 막 날까 System.out.print(i+"\t"); if((i+totalDays+1)%7==0)// 7개만 들가록 바( ) System.out.print("\n"); } System.out.print("\n"); } }