title: DateTime algorithm suggestion
body: <p>My requirement is to calculate a date based on another date.
  The general rules needed for calculation are:</p>
  
  <ol>
  <li>If input date occurs beetwen April 1st and September 30th (any year), the calculated result should be equal to December 31th of the input year</li>
  <li>If input date occur between October 1st and March 31th, then the calculated result should be equal to "next" June 30th.</li>
  </ol>
  
  <p>As per those requirements I have this code:</p>
  
  <pre><code>DateTime tmpDate = new DateTime( 2000, inputDate.Month, inputDate.Day );
  DateTime aprilDate = new DateTime( 2000, 4, 1 );
  DateTime septemberDate = new DateTime( 2000, 9, 30 );
  DateTime endofYearDate = new DateTime( 2000, 12, 31 );
  DateTime resultDate = DateTime.MaxValue;
  
  if ( tmpDate &gt;= aprilDate &amp;&amp; tmpDate &lt;= septemberDate ) {
      resultDate = new DateTime( inputDate.Year, 12, 31, 23, 59, 59 );
  }
  else {
      if ( tmpDate &gt; septemberDate &amp;&amp; tmpDate &lt;= endofYearDate ) {
          resultDate = new DateTime( inputDate.Year, 12, 31, 23, 59, 59 );
      }
      else {
          resultDate = new DateTime( inputDate.Year + 1, 12, 31, 23, 59, 59 );
      }
  }
  </code></pre>
  
  <p>However I think that this code it's a little bit messy. How can I write it in a better way?</p>