日期:2014-05-20  浏览次数:20877 次

急求高手帮忙
哪位高手帮我看一段JAVA的程序哪错了,3Q了!
import java.io.*;
import java.lang.String;
public class WeekDay {

 /**
  * @param args
  */
 public static int weekday;
 public static int month;
 public WeekDay(){
  weekday=5;
  month=10;
 }
 public WeekDay(int monthin,int weekdayin){
  month=monthin;
  weekday=weekdayin;
 }
 public String getweekdayname(){
  switch(weekday){
  case 1:return "Monday";
  case 2:return "Tuesday";
  case 3:return "Wednesday";
  case 4:return "Thursday";
  case 5:return "Saturday";
  case 6:return "Sunday";
  case 0:return " ";
  }
 }
 public String getmonthname(){
  switch(month){
  case 1:return "January";
  case 2:return "February";
  case 3:return "March";
  case 4:return "April";
  case 5:return "May";
  case 6:return "June";
  case 7:return "July";
  case 8:return "Augest";
  case 9:return "September";
  case 10:return "October";
  case 11:return "November";
  case 12:return "December";
  default:return " ";
  }
 }
 public static void main(String[] args) {
  public int monthin=0,dayin=0;
 public int weekdayin=3;
 public int num;
 System.out.print("请输入月份和日期(输入回车表示默认选择10月1日),月份:");
 InputStreamReader ir;
 BufferedReader in;
 String s=new String();
  
 boolean b=true;
try{
 ir=new InputStreamReader(System.in);
 in=new BufferedReader(ir);
 while(b){
  s=in.readLine();
  try{
  monthin=Integer.parseInt(s);
  if(monthin<1||monthin>12){
  System.out.println("月份输入错误!请重试:");
  continue;
  }
  b=false;
 }catch(NumberFormatException e){
  if(s.length()==0){
  WeekDay example=new WeekDay();
  System.out.println(example.getmonthname()+","+1+",2004 is"+example.getweekdayname()+"!");
  return;
  }
  else{
  System.out.println("非数字!请重试:");
  continue;
  }
 }
}
}catch (IOException e){
 System.out.println(e);
}
switch(monthin){
 case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:num=31;break;
  case 4:
  case 6:
  case 9:
  case 11:num=30;break;
  case 2: num=29;break;
  default:num=0;break;
}
  System.out.print("请输入日期:");
  b=true;
  try{
  InputStreamReader ir = new InputStreamReader(System.in);
  BufferedReader in = new BufferedReader(ir);
  boolean b;
  while(b){
  s=in.readLine();
  try{
  dayin = Integer.parseInt(s);
  if(dayin<1||dayin>num){
  System.out.println("日期输入错误!请重试:");
  continue;
  }
  b=false;
  }catch(NumberFormatException e){
  System.out.println("非数字!请重试:");
  continue;
  }
  }
}catch (IOException e){
 System.out.println(e);
}
for(int i=1;i<monthin;i++){