public static void Main()
    {
        // Creates and initializes a JulianCalendar.
        JulianCalendar myCal = new JulianCalendar();

        // Displays the header.
        Console.Write("YEAR\t");
        for (int y = 2001; y <= 2005; y++)
        {
            Console.Write("\t{0}", y);
        }
        Console.WriteLine();

        // Displays the value of the CurrentEra property.
        Console.Write("CurrentEra:");
        for (int y = 2001; y <= 2005; y++)
        {
            Console.Write("\t{0}", myCal.GetMonthsInYear(y, JulianCalendar.CurrentEra));
        }
        Console.WriteLine();

        // Displays the values in the Eras property.
        for (int i = 0; i < myCal.Eras.Length; i++)
        {
            Console.Write("Era {0}:\t", myCal.Eras[i]);
            for (int y = 2001; y <= 2005; y++)
            {
                Console.Write("\t{0}", myCal.GetMonthsInYear(y, myCal.Eras[i]));
            }
            Console.WriteLine();
        }
    }
Пример #2
0
    public static void Main()
    {
        // Creates and initializes a JulianCalendar.
        JulianCalendar myCal = new JulianCalendar();

        // Checks all the months in five years in the current era.
        int iMonthsInYear;

        for (int y = 2001; y <= 2005; y++)
        {
            Console.Write("{0}:\t", y);
            iMonthsInYear = myCal.GetMonthsInYear(y, JulianCalendar.CurrentEra);
            for (int m = 1; m <= iMonthsInYear; m++)
            {
                Console.Write("\t{0}", myCal.IsLeapMonth(y, m, JulianCalendar.CurrentEra));
            }
            Console.WriteLine();
        }
    }