title: C# getting next day entered by user
body: <p>I am creating my own date class which should get the next day inputted by the user e.g. if a user types in <code>18/03/1920</code> for example then this should return the next day. The format currently is <code>dd/MM/yyyy</code>. I was just wondering how would I come across solving this?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace date
  {
      class Program
      {
          static void Main(string[] args)
          {
              Console.WriteLine("please enter date as dd/MM/yy");
              Console.ReadLine();
              date i = new date(01, 12, 1920);
              Console.WriteLine("{0}/{1}/{2}", i.day, i.month, i.year);
              Console.ReadLine();
          }
          class date
          {
              public int month; // 1-12
              public int day; // 1-31 depending on month
              private int value;
              public int year
              {
                  get;
                  private set;
              }
              public date(int day, int month, int year)
              {
                  this.day = day;
                  this.month = month;
                  this.year = year;
                  Console.WriteLine("Date object constructor for date {0}");
              }
  
              public int getYear()
              {
                  return year;
              }
  
              public void setYear()
              {
                  if (value &gt; 1900 &amp;&amp; value &lt;= 2020)
                      year = value;
                  else
                      throw new ArgumentOutOfRangeException("year", value, "out of bounds");
              }
  
              public int getMonth()
              {
                  return month;
              }
  
              public void setMonth()
              {
                  if (value &gt; 0 &amp;&amp; value &lt;= 12)
                      month = value;
                  else
                      throw new ArgumentOutOfRangeException("Month", value, "Month must be 1-12");
              }
  
              public int getDay()
              {
                  return day;
              }
  
              public void setDay()
              {
                  int[] days = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  
                  if (value &gt; 0 &amp;&amp; value &lt;= days[month])
                      day = value;
  
                  else if (month == 2 &amp;&amp; value == 29 &amp;&amp;
                      year % 400 == 0 || (year % 4 == 0 &amp;&amp; year % 100 != 0))
                      day = value;
                  else
                      throw new ArgumentOutOfRangeException("Day", value, "day is out of range");
              }
          }
      }
  }
  </code></pre>