title: test if keyboard inputed string has valid date and format
body: <p>I am having problems trying to write the correct code to test whether a string from the keyboard contains a valid date with the correct amount of months, days for each particular month and format mm/dd/yyyy with adjustments for leap years here is what Ive done so far  I dont think I am even close but any help would be greatly appreciated. Thanks in advance </p>
  
  <pre><code>/* read a date from a string from the keyboard to determine if date is in mm/dd/yyyy format.
  
   */
  import java.util.Scanner;
  
  public class DateFormat
  
  {
  
  public static void main(String [ ] args)
  
  {
  
     Scanner inp = new Scanner(System.in);
  
     System.out.println("Enter the date in mm/dd/yyyy format. ");
  
      int mm;
  
      int dd;
  
      int yy;
  
      int date = inp.nextInt();
  
      boolean isLeapYear;
  
          if ((mm &lt;1) &amp;&amp; (mm &gt;12))
  
              System.out.println( date + " is not valid month must be between 1 and 12.");
         if (( mm = 4) &amp;&amp;  ( dd &lt;=30 ))
              System.out.println( date + " is a valid date."); 
              }
                  else 
                      System.out.println(date + " is not valid date must have 30 or less days. ");
           if (date = mm + "/" + dd + "/" + yy);
              System.out.println( date + " is a valid date format. ");
          }
          else{
              System.out.println( date + " is not valid must be in dd/mm/yyyy format.");
  
              if (yy %100 ==0) {
            if (yy % 400 ==0){
                isLeapYear = true;
            }    
            else{
                isLeapYear = false;
            }   
          }  
          else{
              if (yy %4 ==0){
               isLeapYear = true;
              }
              else{
               isLeapYear = false;
  
             if (isLeapYear)
             if ((mm ==2) &amp;&amp; (dd &lt;= 29 ))
              System.out.println(date + " is a valid date.");
             }
             else{
                 System.out.println( date + "is not valid month must have 29 days or less.");
              if ((mm ==2) &amp;&amp; (dd&lt;=28))
                  System.out.println( date + "  is a valid date.");
              }
              else{
                  System.out.println( date + "is not valid must have 28 days or less. ");
  </code></pre>