Пример #1
0
        static void Main(string[] args)
        {
            if (args.Length != 1) //Not enough number of arguments
            {
                throw new Exception("Invalid Number of arguments!");
            }
            try
            {
                //Reading argument as filename
                string fileName = args[0];

                //Initializing the traingle of Claims instance
                TriangleOfClaims triangleOfClaims = new TriangleOfClaims(fileName);

                //Calculating accumulated claims by calling the method below.
                List <AccumulatedClaims> accumulatedClaims = triangleOfClaims.CreateCumulativeTriangleOfClaims();

                //Writing the result to a file.
                triangleOfClaims.WriteToFile(accumulatedClaims, @"C:\temp\AccumulatedClaims.txt");
            }
            catch (Exception ex)
            {
                //If the validation of either filename or loan amount is failed, an exception will raise
                Console.WriteLine(ex.Message);
                Console.WriteLine();
                Console.WriteLine(@"USAGE: cmd> [application] [csv_file]");
                Console.WriteLine();
                Console.WriteLine(@"Example1: cmd>accumulate claims.csv");
                Console.WriteLine(@"Example2: cmd>accumulate c:\temp\claims.csv");
                Console.WriteLine();
                Console.WriteLine("Program has terminated!");
                return;
            }
        }
 public void Setup(string fileName = "payments.csv")
 {
     triangleofClaims = new TriangleOfClaims(fileName);
 }
Пример #3
0
 public void Setup(string fileName = "payments.csv")
 {
     triangleofClaims = new TriangleOfClaims(fileName);
 }