Example #1
0
        public static TSquare operator *(double n, TSquare Square)
        {
            TSquare sum = new TSquare();

            sum.side = n * Square.side;
            return(sum);
        }
Example #2
0
        static void Main(string[] args)
        {
            TSquare Square  = new TSquare();
            TSquare Square2 = new TSquare();

            Console.WriteLine("Side of Square equals: " + Square);
            Console.WriteLine("Side of Square2 equals: " + Square2);
            Console.WriteLine();
            Square.GetArea();
            Square.GetPerimeter();
            TSquare.Compare(Square, Square2);

            Square2.GetArea();
            Square2.GetPerimeter();

            Console.WriteLine("Sum of squares " + (Square + Square2));

            Console.WriteLine();


            TCube cube = new TCube();

            Console.WriteLine("Side of cube equals: " + cube);
            cube.Volume();
        }
Example #3
0
        public static TSquare operator *(TSquare Square, double n)
        {
            TSquare sum = new TSquare();

            sum.side = Square.side * n;
            return(sum);
        }
Example #4
0
        public static TSquare operator -(TSquare Square, TSquare Square2)
        {
            TSquare sum = new TSquare();

            sum.side = Math.Abs(Square.side - Square2.side);
            return(sum);
        }
Example #5
0
        public static TSquare operator +(TSquare Square, TSquare Square2)
        {
            TSquare sum = new TSquare();

            sum.side = Square.side + Square2.side;
            return(sum);
        }
Example #6
0
 public static void Compare(TSquare Square, TSquare Square2)
 {
     if (Square.side > Square2.side)
     {
         Console.WriteLine(Square.side + " > " + Square2.side + " on " + (Square.side - Square2.side));
     }
     else if (Square.side < Square2.side)
     {
         Console.WriteLine(Square.side + " < " + Square2.side + " on " + (Square2.side - Square.side));
     }
     else if (Square.side == Square2.side)
     {
         Console.WriteLine(Square.side + " = " + Square2.side);
     }
 }
Example #7
0
 public TSquare(TSquare Square)
 {
     this.side = Square.side;
 }