Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _1.Point3D
  8. {
  9.     class Point3D
  10.     {
  11.         private static readonly Point3D origin;
  12.  
  13.  
  14.         private double xCoordinate;
  15.         private double yCoordinate;
  16.         private double zCoordinate;
  17.  
  18.         static Point3D()
  19.         {
  20.             origin = new Point3D(0, 0, 0);
  21.         }
  22.  
  23.         public Point3D(double x, double y, double z)
  24.         {
  25.             this.XCoordinate = x;
  26.             this.YCoordinate = y;
  27.             this.ZCoordinate = z;
  28.         }
  29.  
  30.         public static Point3D Origin
  31.         {
  32.             get { return Point3D.origin; }
  33.         }
  34.  
  35.         public double XCoordinate
  36.         {
  37.             get { return xCoordinate; }
  38.             set { xCoordinate = value; }
  39.         }
  40.  
  41.         public double YCoordinate
  42.         {
  43.             get { return yCoordinate; }
  44.             set { yCoordinate = value; }
  45.         }
  46.  
  47.         public double ZCoordinate
  48.         {
  49.             get { return zCoordinate; }
  50.             set { zCoordinate = value; }
  51.         }
  52.  
  53.         public override string ToString()
  54.         {
  55.             string pointCoordinates = String.Format("X: {0}, Y: {1}, Z: {2}", this.xCoordinate, this.yCoordinate, this.zCoordinate);
  56.  
  57.             return pointCoordinates;
  58.         }
  59.  
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement