问题

    有哪位朋友愿意帮助我看看这个错误。错在那里???
求救呀!
 
 
 
内容如下:
 
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
package Tian;
import java.io.*;
 
/**
 *
 * @author ivan.luck2008
 */
import java.io.*;
 
class  daysInMonth
{
         static int year;
         static int month;
 
    //constructors
       public daysInMonth()
       {
     
         //System.out.println(month+" in "+year+" has "+days+"days");
 
 
       
    }
 
 
 
 
 
      
       //Test method
 
       public static int  accountDays(int year,int month)
    {
                            int flag;
 
                switch (month) {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                                          flag=31;
                         break;
                case 2:
                        if(isLeap(year))
                                                 flag=29;
 
                        else
                                             flag=28;
                                          break;
                default:
                        flag=31;
                        break;
                }
                            return flag;
        }
 
 
              //test Feb is isLeap or not
              public static boolean isLeap(int year)
        {
                if (year%4 == 0 && year%100 != 0)
                        return true;
                else if (year%100 == 0 && year%400 == 0)
                        return true;
                else
                        return false;
        }
 
 
              public static void main(String args[])
       {
                       String m,y;
        InputStreamReader in=new InputStreamReader(System.in);
        BufferedReader b=new BufferedReader(in);
        daysInMonth d=new daysInMonth();
        try
        {
            m=b.readLine();
            y=b.readLine();
 
            //transForm
            month=Integer.parseInt(m);
            year=Integer.parseInt(y);
            //class
          
 
        }catch(IOException e){
            System.out.println(e);
        }
                    
               int days=daysInMonth.accountDays(year, month);
            System.out.println(month+" in "+year+" has "+days+"days");
 
 
       }
}
程序运行结果如下, 本程序是想解决一个小小的黑盒测试,愿意是输入年份和月份。直接能够显示出结果格式是:
Eg
  Month 2 in 2000 has 29 days
有谁帮我看看错在那里!
 

你可能感兴趣的:(职场,错误,休闲,改正,帮忙)