示例#1
0
        public void Test3()
        {
            C_Assignment3.Math objMath3 = new C_Assignment3.Math(1);
            float result3 = objMath3.CalculatePerimeter(1);

            Assert.IsType <float>(result3);
            Assert.Equal(4, result3);
        }
示例#2
0
        public void Test1()
        {
            C_Assignment3.Math objMath1 = new C_Assignment3.Math(1, 2, 3);
            float result1 = objMath1.CalculatePerimeter(1, 2, 3);

            Assert.IsType <float>(result1);
            Assert.Equal(6, result1);
        }
示例#3
0
        public void Test2()
        {
            C_Assignment3.Math objMath2 = new C_Assignment3.Math(2, 3);
            float result2 = objMath2.CalculatePerimeter(2, 3);

            Assert.IsType <float>(result2);
            Assert.Equal(10, result2);
        }
示例#4
0
        static void Main()
        {
            float a; float side1, side2, b; float pt, pr, ps;

start:
            Console.WriteLine("Make your Choice");
            Console.WriteLine("1.TrianglePerimeter \n2.RectanglePerimeter \n3.SquarePerimeter");
            a = float.Parse(Console.ReadLine());
            switch (a)
            {
            case 1:
                Console.WriteLine("Input the length of the first side of your triangle");
                side1 = float.Parse(Console.ReadLine());
                Console.WriteLine("Input the length of the second side of your triangle");
                side2 = float.Parse(Console.ReadLine());
                Console.WriteLine("Input the length of the base of your triangle");
                b = float.Parse(Console.ReadLine());
                Math Triangle = new Math(side1, side2, b);
                pt = Triangle.CalculatePerimeter(side1, side2, b);
                break;

            case 2:
                Console.WriteLine("Input the values of the first side of your rectangle");
                side1 = float.Parse(Console.ReadLine());
                Console.WriteLine("Input the values of the second side of your rectangle");
                side2 = float.Parse(Console.ReadLine());
                Math Rectangle = new Math(side1, side2);
                pr = Rectangle.CalculatePerimeter(side1, side2);
                break;

            case 3:
                Console.WriteLine("Input the value of the side of your square");
                side1 = float.Parse(Console.ReadLine());
                Math Square = new Math(side1);
                ps = Square.CalculatePerimeter(side1);
                break;

            default: Console.WriteLine("Your input is Invalid. Please make a proper choice");
                goto start;
            }
        }