//=============Q2===================
//even though i am not sure what should be returned if exception has occured
//you might think about it yourself
// :-)
//and i m also not sure why to write a class here..
//a method will be well enough for doing this
public class Cla{
public Cla(){}
public int convert(String s){
try{
return Integer.parseInt(s);
}catch(NumberFormatException e){
System.out.println("Whatever message is");
}
return -1;
}
}
//===============Q1=================
public int dayInMonth(int month){
if (month == 1|month == 3|month == 5|month == 7|month == 8|month == 10|month == 12)
return 31;
else if (month == 2)
return 28;
else
return 30;
}