import java.io.*;
class valid
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("entre the date");
int d=Integer.parseInt(br.readLine());
System.out.println("entre month");
String s=br.readLine();
System.out.println("entre year");
int y=Integer.parseInt(br.readLine());
int t=0;
String month[]={"january","february","march","aprai","may","june","july","august","september","october","november","december"};
int year[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(y%4==0)
{
year[1]=29;
}for(int i=0;i<12;i++)
{
if(s.equalsIgnoreCase(month[i]))
{
t=i;
}
}
if(d<=year[t])
{
for(int i=0;i<12;i++)
{
if(s.equalsIgnoreCase(month[i]))
{
t=i;
}
}
for(int i=0;i<t;i++)
{
d=d+year[i];
}
System.out.println(d+"days"+y);
}
else
System.out.println("invalid date");
}
}
No comments:
Post a Comment
HAY THAKYOU FOE VISIT