public static void Example4() { DateTime startDate = new Date(2009, 8, 3).DateValue; DateTime endDate = new Date(2014, 10, 3).DateValue; // Now test with bool as well bool adjusted = true; int paymentPerYear = 2; bool arrears = false; int fixingDays = -2; bool shortPeriod = true; DateSchedule myDL_1 = new DateSchedule(startDate, endDate, paymentPerYear, shortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("Marix<Date> GetLongScheduleDate()"); myDL_1.PrintDateMatrix(myDL_1.GetLongScheduleDate()); Console.WriteLine(); Console.WriteLine("Matrix<double> GetLongScheduleSerial()"); myDL_1.GetLongScheduleSerial().extendedPrint(); Console.WriteLine(); Console.WriteLine("Marix<Date> GetShortScheduleDate()"); myDL_1.PrintDateMatrix(myDL_1.GetShortScheduleDate()); Console.WriteLine(); Console.WriteLine("Array<Date>PaymentDateArray()"); myDL_1.PrintDateArray(myDL_1.PaymentDateArray()); Console.WriteLine(); Console.WriteLine("count numbers of rows: public int Length " + myDL_1.Length); }
public static void Example8() { // DateSchedule. The output of is a matrix of dates, for scheduled payments period, each rows is a period // for columns: // 1° column fixing date // 2° column startingDate of period // 3° column endDate of period // 4° column payment date of period DateTime startDate = new Date(2009, 8, 3).DateValue; DateTime endDate = new Date(2014, 10, 3).DateValue; bool adjusted = true; int paymentPerYear = 2; bool arrears = false; int fixingDays = -2; bool firstShortPeriod = true; DateSchedule myDL_1 = new DateSchedule(startDate, endDate, paymentPerYear, firstShortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("Starting DateSchedule"); myDL_1.PrintDateMatrix(); Console.WriteLine(); adjusted = false; DateSchedule myDL_2 = new DateSchedule(startDate, endDate, paymentPerYear, firstShortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("adjusted = 0, 3° column can be Sat or Sun"); myDL_2.PrintDateMatrix(); Console.WriteLine(); paymentPerYear = 1; DateSchedule myDL_3 = new DateSchedule(startDate, endDate, paymentPerYear, firstShortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("paymentPerYear = 1, frequency of payment changed"); myDL_3.PrintDateMatrix(); Console.WriteLine(); arrears = true; DateSchedule myDL_4 = new DateSchedule(startDate, endDate, paymentPerYear, firstShortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("arrears = 1, 1° column count fixing date starting from 3° column and not from 2° column"); myDL_4.PrintDateMatrix(); Console.WriteLine(); fixingDays = 0; DateSchedule myDL_5 = new DateSchedule(startDate, endDate, paymentPerYear, firstShortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("fixingDays = 0, 1° column has a different leg"); myDL_5.PrintDateMatrix(); Console.WriteLine(); firstShortPeriod = false; DateSchedule myDL_6 = new DateSchedule(startDate, endDate, paymentPerYear, firstShortPeriod, adjusted, arrears, fixingDays); Console.WriteLine("shortPeriod = 2, changed the short period"); myDL_6.PrintDateMatrix(); Console.WriteLine(); }