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.0088 sec