Example #1
0
        public void AverageTest()
        {
            double[] array = {1, 2, 3 };
            double exp = 2;

            ArrayCalcs calc = new ArrayCalcs();
            double act = calc.Average(array);

            Assert.AreEqual(exp, act);
        }
Example #2
0
 static void Main(string[] args)
 {
     ArrayCalcs acalc = new ArrayCalcs();
     double[] array = { 1.0, 2.0, 3.3, 5.5, 6.3, -4.5, 12.0 };
     double sum = acalc.Sum(array);
     double ave = acalc.Average(array);
     double max = acalc.Max(array);
     double min = acalc.Min(array);
     Console.WriteLine("Array\n - Max: " + max + "\n - Min: " + min + "\n - Average: " + ave + "\n - Sum: " + sum);
 }