Esempio n. 1
0
        static void Main(string[] args)
        {
            var Series = new Series <Firgure>();

            Series.Changed += ChangeListener;
            Series.Add(new Parallelepiped(0, 0, 0));
            Series.Add(new Cone(1, 4));
            Series.Insert(1, new Cone(3, 1));
            Series.Add(new Parallelepiped(6, 5, 4) + new Parallelepiped(1, 2, 4));
            Series.Add(new Ball(37));
            Series.Delete(1);
            Console.WriteLine(Series);


            try
            {
                Series.Get(48);
            }
            catch (IndexOutOfRangeException)
            {
                Console.WriteLine("IndexOutOfRangeException");
            }

            try
            {
                Parallelepiped x = (Parallelepiped)Series.Get(0) / 0;
            }
            catch (DivideByZeroException)
            {
                Console.WriteLine("DivideByZeroException");
            }

            Console.WriteLine((Parallelepiped)Series.Get(0) == new Parallelepiped(1, 2, 50) * 0);
            Console.ReadKey();
        }
Esempio n. 2
0
        public static Parallelepiped operator*(Parallelepiped x, double y)
        {
            Parallelepiped ans = new Parallelepiped();

            ans.a = x.a * y;
            ans.b = x.b * y;
            ans.c = x.c * y;
            return(ans);
        }
Esempio n. 3
0
        public static Parallelepiped operator-(Parallelepiped x, Parallelepiped y)
        {
            Parallelepiped ans = new Parallelepiped();

            ans.a = x.a - y.a;
            ans.b = x.b - y.b;
            ans.c = x.c - y.c;
            return(ans);
        }
Esempio n. 4
0
        public override bool Equals(object x)
        {
            Parallelepiped obj = (Parallelepiped)x;

            if (a == obj.a && b == obj.b && c == obj.c)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        public static Parallelepiped operator/(Parallelepiped x, double y)
        {
            if (y == 0.0)
            {
                throw new DivideByZeroException();
            }
            Parallelepiped ans = new Parallelepiped();

            ans.a = x.a / y;
            ans.b = x.b / y;
            ans.c = x.c / y;
            return(ans);
        }