文件名称:java的控制台日历
文件大小:3KB
文件格式:RAR
更新时间:2012-06-18 04:43:28
日历
是一个java的控制台的日历程序
import java.util.Scanner;
class page100_calender{
private int year;
private int firstStartDay;
page100_calender(int year,int firstStartDay){
this.year=year;
this.firstStartDay=firstStartDay;
}
public void printCalender(){
for(int i=1;i<=12;i++){
printTitle(i);
printMonthBody(i);
System.out.println();
}
}
public void printTitle(int month){
System.out.println(" "+getMonthName(month)+" "+year);
System.out.println("_____________________________");
System.out.println(" Sun Mon Tue Web Thu Fri Sat ");
}
public String getMonthName(int month){
String monthName=null;
switch(month){
case 1:monthName="January"; break;
case 2:monthName="February";break;
case 3:monthName="Marth";break;
case 4:monthName="April";break;
case 5:monthName="May";break;
case 6:monthName="June";break;
case 7:monthName="July";break;
case 8:monthName="August";break;
case 9:monthName="September";break;
case 10:monthName="October";break;
case 11:monthName="November";break;
case 12:monthName="December";break;
}
return monthName;
}
public void printMonthBody(int month){
int startDay=getStartDay(month);
int numberOfDaysMonth=getNumberOfDaysInMonth(month);
int i=0;
for(i=0;i
【文件预览】:
page100_calender
----page100_calender.class(2KB)
----page100_4_29_main.class(748B)
----page100_calender.java(2KB)