Beispiel #1
0
        static void doWork()
        {
            Console.WriteLine("Running class program...");
            //int nicki = 42;
            //int = integer which is a type, nicki is a name, = is an assignment operator
            Point origin = new Point();
            //it instantiates a point object name origin
            //Point() is a constructor which returns a memory address
            //new allocates memory and returns a memory address
            //origin is a name, and Point is a type
            Point bottomRight = new Point(1366, 768);
            //constructor point has integers of 1366, 786 allocated memory by new assigned to the name bottomright
            //it instantiates a point object name bottomright
            Point  proof    = new Point();
            double distance = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Point Nicki  = new Point(0, 0);
            Point Dwaine = new Point(3, 4);

            distance = Nicki.DistanceTo(Dwaine);
            Console.WriteLine($"Distance between nicki and dwaine is: {distance}");
            Point Matt = new Point(6, 25);

            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #2
0
        static void doWork()
        {
            Point  origin      = new Point();
            Point  bottomRight = new Point(3, 4);
            double distance    = bottomRight.DistanceToPoint(origin);

            Console.WriteLine($"Distance is {distance}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #3
0
        static void DoWork()
        {
            var origin      = new Point();
            var bottomRight = new Point(1366, 768);
            var distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine("Distance is: {0}", distance);
            Console.WriteLine("Number of Point objects: {0}", Point.ObjectCount());
        }
Beispiel #4
0
        static void doWork()
        {
            Point  origin      = new Point(); //IT goes to the heap it allocates space sufficient for the objeect and returns the address
            Point  bottomRight = new Point(1366, 768);
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #5
0
        static void DoWork()
        {
            Point  origin      = new Point();
            Point  bottomRight = new Point(1024, 1280);
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine("Distance is: {0}", distance);
            Console.WriteLine("No of Point objects: {0}", Point.ObjectCount());
        }
Beispiel #6
0
        static void doWork()
        {
            Point  origin      = new Point();
            Point  bottomRight = new Point(1366, 768);
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #7
0
        static void doWork()
        {
            Console.WriteLine("Running Class program...");
            Point  origin      = new Point();          //intantiates point object origin
            Point  bottomRight = new Point(1366, 768); //instantiate point object bottom right
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #8
0
        static void doWork()
        {
            Point  origin      = new Point();
            Point  bottomRight = new Point(1366, 768);
            Point  Ajay        = new Point(77, 12);
            double distance    = origin.DistanceTo(bottomRight);
            double distance2   = Ajay.DistanceTo(origin);
            int    oc          = Point.ObjectCount();

            Console.WriteLine($"the object count is {oc}");
        }
Beispiel #9
0
        static void doWork()
        {
            Point  origin      = new Point(); //creates new instance of point; invokes its default constructor
            Point  bottomRight = new Point(1366, 768);
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            (int xVal, int yVal) = origin; // deconstruct to retrieve private fields
            Console.WriteLine($"Deconstructor values. x = {xVal}, y = {yVal}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
        private static void DoWork()
        {
            Point origin      = new Point();
            Point bottomRight = new Point(1366, 768);

            double distance = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is {distance}");

            (int xVal, int yVal) = bottomRight;

            Console.WriteLine($"bottomRight._x = {xVal}, bottomRight._y = {yVal}");

            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #11
0
        static void doWork()
        {
            Point  origin      = new Point();          // instances of the class
            Point  bottomRight = new Point(1366, 768); // instances// point object
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Point maxwell = new Point(1, 1);
            Point roxana  = new Point(4, 5);

            distance = maxwell.DistanceTo(roxana);
            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects:{Point.ObjectCount()}." +
                              $"This is he value of objectCount");
        }
Beispiel #12
0
        static void doWork()
        {
            Point  origin      = new Point();
            Point  bottomRight = new Point(1366, 768);
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Point maxwell = new Point(1, 1);
            Point christy = new Point(4, 5);

            distance = maxwell.DistanceTo(christy);
            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}." +
                              $" This is the value of objectCount.");
        }
Beispiel #13
0
        static void doWork()
        {
            Point origin      = new Point();     //orgin is an object or an instance
            Point origin1     = new Point(2, 3); //orgin1 is an object or an instance
            Point bottomRight = new Point(1366, 768);
            Point first       = new Point(0, 0);
            Point second      = new Point(4, 3);

            double distance = first.DistanceTo(second);

            Console.WriteLine($"Distance 2 is {distance}");
            double distance2 = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance2}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #14
0
        static void doWork()
        {
            Point  origin      = new Point();                    // default constructor
            Point  bottomRight = new Point(1366, 768);           // a setted point
            Point  NewP        = new Point();                    // new random point
            double distance    = origin.DistanceTo(bottomRight); //Distance from point 1(origin) to point 2(bottomRight)

            Console.WriteLine("Distance is: {0}", distance);     //Print the distance for the 2 setted points
            //Print the number of point objects
            Console.WriteLine("Number of Point objects: {0}", Point.ObjectCount());
            //-----------------//
            double distance2 = bottomRight.DistanceTo(NewP);  //print the distance from Point2(bottomRight) to Point 3(NewP)

            Console.WriteLine("Distance is: {0}", distance2); //Print the distance
            //-----------------//
        }
Beispiel #15
0
        static void doWork()
        {
            Console.WriteLine("Running class program");
            Point  origin      = new Point();
            Point  bottom      = new Point();
            Point  proof       = new Point();
            Point  bottomRight = new Point(1366, 768);
            double distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Point jennifer = new Point(0, 0);
            Point johnny   = new Point(3, 4);

            distance = jennifer.DistanceTo(johnny);
            Console.WriteLine($"Distance between Jennifer and Johnny is: {distance}");
            Point peter = new Point(63, 180);

            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
        }
Beispiel #16
0
        static void doWork()
        {
            Point origin      = new Point(3, 4);                // This is the constructor
            Point origin2     = new Point();
            Point origin3     = new Point(3, 5, 7);
            Point bottomRight = new Point(1366, 768);
            Point point1      = new Point(0, 0);
            Point point2      = new Point(3, 4);
            Point origin4     = new Point(1, 2, 3);

            Console.WriteLine($"distance between point1 and point2 is: " +
                              $"{point1.DistanceTo(point2)}");
            Console.WriteLine($"distance between point2 and point1 is: " +
                              $"{point2.DistanceTo(point1)}");              // Instance method DistanceTo is called on the instance Point
            Console.WriteLine($"distance between point1 and point1 is: " +
                              $"{point1.DistanceTo(point1)}");
            Console.WriteLine($"The number of points created is: " +
                              $"{Point.ObjectCount()}");
            Console.WriteLine($"distance between origin3 and origin4 is: " +
                              $"{origin3.DistanceToTriple(origin4)}");
        }
Beispiel #17
0
        static void doWork()
        {
            Point origin      = new Point();
            Point origin1     = new Point(2, 3);
            Point bottomRight = new Point(1366, 768);
            Point first       = new Point(0, 0);
            Point second      = new Point(4, 3);

            first.ToString();
            second.ToString();

            double distance2 = first.DistanceTo(second);

            Console.WriteLine($"Distance2 is {distance2}");
            double distance = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Point.ObjectCount()}");
            double distance3 = second.DistanceTo(first);

            Console.WriteLine($"Distance3 is {distance3}");
        }