title: Java code to determine number of days elapsed does not return correct answer
body: <p>The problem with this code is that it does calculate the days alive only for some birth dates. I tried using different birth dates and testing it with an online calculator and it seems not all are correct. I think the problem is because of Leapyears, more and less than 30 days in a month.</p>
  
  <pre><code>public class DaysAlive {
  
  public static void main (String [] args){
  
      Scanner userInput = new Scanner(System.in);
  
      int TodayYear, TodayMonth, TodayDay;
      int YearBorn, MonthBorn, DayBorn;
      int DaysAlive;
  
      System.out.println("Enter today's date");
      System.out.print ("Year: ");
      TodayYear = userInput.nextInt ();
      System.out.print ("Month: ");
      TodayMonth = userInput.nextInt ();
      System.out.print ("Day: ");
      TodayDay = userInput.nextInt ();
  
      System.out.println("Enter date of birth");
      System.out.print ("Year: ");
      YearBorn = userInput.nextInt ();
      System.out.print ("Month: ");
      MonthBorn = userInput.nextInt ();
      System.out.print ("Day: ");
      DayBorn = userInput.nextInt ();
  
      //I think this line is the problem 
      DaysAlive = (TodayYear - YearBorn) *365 + (TodayMonth - MonthBorn) *30 +(TodayDay - DayBorn);
  
      System.out.println("DaysAlive: " + DaysAlive);
  
  
  
        }
  }
  </code></pre>