U E D R , A S I H C RSS

만년달력/영동

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");
	}
}
----
: Yggdrasil
----
달력
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:26
Processing time 0.1015 sec