title: How to add days to a date with february leap year or not
body: <p>I would like to know what are my mistakes in this code which I coded earlier and have problem testing it or it's incomplete, I want to add the month February specific days which has 28 days or 29 days (leap year or not) </p>
  
  <pre><code>  public void addDays(int x) {
  
      day = day + x;     
      if (day &gt; 31) {     
        day = day - 31;   
        addMonths(1); 
  
      } else if (month == 2 &amp;&amp; ((year % 400 == 0) || year % 4 == 0)) {
          day = day - 29;
          addMonths(1);
  
      }
  </code></pre>
  
  <p>add days wraps months,</p>
  
  <p>add days wraps february non leap year,</p>
  
  <p>add days wraps february leap year,</p>
  
  <p>noting that I have already defined the variables day,month and year in another method as well as the other methods in the code and they work perfectly. Just having problem adding wraps for february leap year or not
  Thanks.</p>
  
  <p>P.S: I'm using this specific methods and classes because of the assignment requirements otherwise i would use the Calender class.</p>