Create the class Vector with three private integer members: x, y, and z.
Implement the following in the class:
Three constructors:
A default constructor that sets all members to .
A constructor with parameters (the parameters are the vector coordinates).
A copy constructor.
The following methods:
double length() – returns the length of the vector;
void setX(int), void setY(int), void setZ(int) – methods to change the corresponding values of the vector;
int getX(), int getY(), int getZ() – methods that return the corresponding coordinates;
void Out() – prints the coordinates of the vector, separated by a space, followed by a newline.
Submit only the class implementation.
class Vector // Java
{
private int x, y, z;
Vector(); // default constructor, sets members to 0
Vector(int x, int y, int z); // constructor with parameters (coordinates)
Vector(Vector v); // copy constructor
void setX(int x); // sets the value of x
void setY(int y); // sets the value of y
void setZ(int z); // sets the value of z
int getX(); // returns the x coordinate
int getY(); // returns the y coordinate
int getZ(); // returns the z coordinate
public double length(); // returns the length of the vector
public void Out(); // prints the vector coordinates, separated by spaces
}