★☆★☆어디가 틀린 걸가요~~~알아맞춰 보아요! ★☆★☆

portishead Reply 9 years 7 weeks ago
import java.util.Scanner; import java.util.Calendar; public class Main{ public static void main(String args[]){ Scanner input = new Scanner(System.in); Calendar calen = Calendar.getInstance(); String year = input.next(); String month = input.next(); calen.set(Calendar.YEAR,Integer.valueOf(year)); calen.set(Calendar.MONTH,Integer.valueOf(month)); int lastDay = calen.getActualMaximum(Calendar.DATE); int sartDate = calen.get(Calendar.DAY_OF_WEEK); int startBlankNum = sartDate; int date = 1; System.out.println(lastDay); System.out.print("Sun Mon Tue Wed Thu Fri Sat\n"); for(int i=1;i<=startBlankNum;i++) System.out.print(" "); for(int i=7-startBlankNum;i<=lastDay+startBlankNum;i++){ if((date+startBlankNum)%7!=0&&date!=lastDay){ if(date<10) System.out.print(" "+date+" "); else if(date>=10) System.out.print(date+" "); } else if((date+startBlankNum)%7!=0&&date==lastDay){ if(date<10) System.out.print(" "+date+"L"); else if(date>=10) System.out.print(date+"L"); } else if((date+startBlankNum)%7==0&&date!=lastDay){ if(date<10) System.out.print(" "+date+"\n"); else if(date>=10) System.out.print(date+"\n"); } else if((date+startBlankNum)%7==0&&date==lastDay){ if(date<10) System.out.print(" "+date+"L"); else if(date>=10) System.out.print(date+"L"); } date++; } } } 왜 달력 마지막 줄이 안나오는걸ㄹ까여? 왜 제 달력은 2월달의 마지막 날이 31일일까여??