So I been working on this program and I have gotten some dates to work out fine but when I input the month of February with a future year it shows that its invalid when it shouldn't be. For the sake of this program days in February are just 1-28. Can anyone help me catch my mistake?
import java.util.Scanner;
public class FutureDate {
public static void main (String args[]){
int inputMonth;
int inputDate;
int inputYear;
final int currentMonth = 10;
final int currentDate = 24;
final int currentYear = 2013;
final int numberOfDays = 31;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter a month in format - mm: ");
inputMonth = keyboard.nextInt();
System.out.println("Enter a day in format - dd: ");
inputDate= keyboard.nextInt();
System.out.println("Enter a year in format - yyyy: ");
inputYear = keyboard.nextInt();
if (inputYear < currentYear)
System.out.println("Invalid Date");
else if (inputYear >= currentYear)
{
if (inputMonth >= 1 && inputMonth <=12){
if ((inputMonth == 4 || inputMonth == 6 || inputMonth == 9 || inputMonth == 11) && (inputDate >= 1 && inputDate <= 30))
System.out.println("Valid Date");
else if (inputMonth > currentMonth && inputDate >= 1 && inputDate <=30)
System.out.println("Valid Date");
else if (inputMonth == currentMonth && inputDate > currentDate && inputDate <=30)
System.out.println("Valid Date");
else
System.out.println("Invalid Date");
}
else if (inputMonth == 2 && inputDate >= 1 && inputDate <= 28){
System.out.println("Valid Date");
if (inputMonth > currentMonth && inputDate >= 1 && inputDate <=28)
System.out.println("Valid Date");
else if (inputMonth == currentMonth && inputDate > currentDate && inputDate<=28)
System.out.println("Valid Date");
else
System.out.println("Invalid Date");
}
else if (inputMonth == 1 || inputMonth == 3 || inputMonth == 5 || inputMonth == 7 || inputMonth ==10 || inputMonth == 12 && inputDate >= 1 && inputDate <= 31){
if (inputMonth > currentMonth && inputDate >= 1 && inputDate <=31)
System.out.println("Valid Date");
else if (inputMonth == currentMonth && inputDate > currentDate && inputDate <=31)
System.out.println("Valid Date");
else
System.out.println("Invalid Date");
}
else
System.out.println ("Invalid Date");
}
}
}