using System; public class date { protected static string[] month_names = {"","January","February","March","April","May","June", "July","August","September","October","November", "December"}; protected static string[] day_names = {"Sunday","Monday","Tuesday","Wednesday","Thursday", "Friday","Saturday"}; protected int d_,m_,y_; public date(int d, int m , int y) { d_=d; m_=m; y_=y; } public date() { d_=1; m_=1; y_=1; } public virtual void print() { Console.WriteLine("{0,2}/{1,2}/{2,4}", d_,m_,y_); } public virtual void print_month() { Console.WriteLine("{0,2}/{1}/{2,4}", d_,month_names[m_],y_); } protected int day_of_week_index() { int index, day, month, year; day = d_; month = m_; year = y_; if (month > 2) month -= 2; else { month += 10; year--; } index = ((13 * month - 1) / 5) + day + (year % 100) + ((year % 100) / 4) + ((year / 100) / 4) - 2 * (year / 100) + 77; index = index - 7 * (index / 7); if (index == 7) index = 0; return (index); } public virtual void print_day() { Console.WriteLine("{0}/{1,2}/{2,4}", day_names[day_of_week_index()],m_,y_); } } public class iso_date : date { public iso_date(int y, int m , int d) { y_=y; m_=m; d_=d; } public iso_date() { y_=1; m_=1; d_=1; } public override void print() { Console.WriteLine("{0,4}/{1,2}/{2,2}", y_,m_,d_); } public override void print_month() { Console.WriteLine("{0,4}/{1}/{2,2}", y_,month_names[m_],d_); } public override void print_day() { Console.WriteLine("{0,4}/{1,2}/{2}", y_,m_,day_names[day_of_week_index()]); } } class c2203 { public static void Main() { date [] d = new date[2]; d[0] = new date(11,2,1952); d[1] = new iso_date(1952,2,11); Console.WriteLine("Normal first, iso second"); d[0].print(); d[1].print(); Console.WriteLine("Normal first, iso second"); d[0].print_day(); d[1].print_day(); Console.WriteLine("Normal first, iso second"); d[0].print_month(); d[1].print_month(); } }//