mmayoub

TestPoint.cs

Dec 17th, 2021 (edited)
1,190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace PointExercise
  6. {
  7.     class TestPoint
  8.     {
  9.         public static void Main(string[] args)
  10.         {
  11.             Point p = new Point(43, 7);
  12.             Point h = new Point(5, 5);
  13.  
  14.             Console.WriteLine("p=" + p);
  15.             Console.WriteLine("h=" + h.ToString());
  16.  
  17.             double tempx = p.GetX();
  18.             p.SetX(h.GetX());
  19.             h.SetX(tempx);
  20.  
  21.             Console.WriteLine("p=" + p);
  22.             Console.WriteLine("h=" + h);
  23.  
  24.             Console.WriteLine("distance=" + p.Distance(h));
  25.             Console.WriteLine("distance=" + h.Distance(p));
  26.  
  27.             Point m = p.Middle(h); // m = h.Middle(p);
  28.             Console.WriteLine("middle=" + m);
  29.  
  30.             // for testing only
  31.             if (p.Distance(m) == m.Distance(h))
  32.             {
  33.                 Console.WriteLine("OK");
  34.             }
  35.         }
  36.     }
  37. }
  38.  
Add Comment
Please, Sign In to add comment