c# - A class definition for a date class that contains three integer data members:month,day,year -


i not sure asking here. example great.

here complete list of requirements. working through exercise in book have been reading have read chapter on , on cant make sense out of it.

  1. a class definition date class contains 3 integer data members:month,day,year

  2. one constructor assigns date 1/1/2000 new object not recieve arguments.

  3. one constructor thats accepts month , day arguements , uses default year of 2004
  4. one constructor thats accepts month, day,and year arguements
  5. each constructor should output message user stating constructor being used.
  6. a method displays values in date object.

public class weirdrequirements {     int m_year, m_month, m_day;     public delegate void messageprinter(string message);     public messageprinter printmessage = console.writeline;      public weirdrequirements()     {         m_year = 2000;         m_month = 1;         m_day = 1;         printmessage("default");     }      public weirdrequirements(int month, int day)     {         m_year = 2004;         m_month = month;         m_day = day;         printmessage("int month, int day");     }      public weirdrequirements(int year, int month, int day)     {         m_year = year;         m_month = month;         m_day = day;         printmessage("int year, int month, int day");     }      public void printvalues()     {         printmessage(string.format("year={0} month={1} day={2}", m_year, m_month, m_day));     } } 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -