Using the Point Class - C++

My assignment is to write a definition of a class named Point used to store and manipulate the location of a point in a plane. You need to declare and implement the following member functions:
1 - a member function set that sets the private data after an object of this class is created.
2 - a member function to move the point by an amount along the vertical and horizontal directions  specified by the first and second arguments.
3 - a member function to rotate the point by 90 degrees clockwise around the origin.
4 - two const inspector functions to retrieve the current coordinates of the point.
Embed your class in a test program that requests data for several points from the user, creates the points, then exercises the member functions.

Here is my code below: I am just trying to get it to work. I can work out the test program later..
Right now I am getting 3 errors.. Please help...

Code:

#include <iostream>
#include <cstdlib>

using namespace std;

class Point
{
public:
      Point();
      //member functions  
      void setPoints(double& set_x, double& set_y);
      //void setPointY(double set_y);
      void movePoints(double& move_x, double& move_y);
      void rotatePoints();
      double get_x()const;
      double get_y()const;
      
      //member variables
private:
      double x, y;
      double adjY, adjX;  
};      
int main()
{
      double x1, y1;
      
      setPoints (x1, y1);
      movePoints(x1, y1);
      rotatePoints();

      return 0;
}
Point::Point()
{
      x=0;
      y=0;
}
void Point::setPoints(double& new_x, double& new_y)
{
      x = new_x;
      y = new_y;

      cout << "Enter the X coordinate:" << endl;
      cin >> x;
      cout << "Enter the Y coordinate:" << endl;
      cin >> y;
}
void Point::movePoints(double& move_x, double& move_y)
{        
      x = x+move_x;
    y = y+move_y;

      cout << "Enter the new X coordinate:" << endl;
      cin >> x;
      cout << "Enter the new Y coordinate:" << endl;
      cin >> y;
      cout << "The new position of the coordinates is:"<<endl;
      cout << get_x()<< ""<<get_y()<<endl;
}
void Point::rotatePoints()
{
 adjX = -y;
 adjY = x;
 cout << "Enter the adjusted x coordinate:" <<endl;
 cin >> adjX;
 cout << "Enter the adjusted y coordinate:" <<endl;
 cin >> adjY;
 
}
double Point::get_x()const
{       
      return x;
}
double Point::get_y()const
{
      return y;
}
vixenmrbAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Infinity08Commented:
>> Right now I am getting 3 errors..

And what would those errors be ?
jkrCommented:
All you need to change is to actually use an instance of the 'Point' class in your 'main()', just change that to the following:
int main()
{
      double x1, y1;

      Point p;
      
      p.setPoints (x1, y1);
      p.movePoints(x1, y1);
      p.rotatePoints();

      return 0;
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vixenmrbAuthor Commented:
The errors are on the function calls. It states for example:
error C3861: 'setPoints': identifier not found
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Infinity08Commented:
I think jkr got that ;)
vixenmrbAuthor Commented:
Thanks IKR - that helped but I am still having a problem understanding the rotation of 90 degrees clockwise. I think I have part of it but not the full formula -- something is missing.. If not a help to my code can you at least give me an explanation about rotating a point. Thanks..
jkrCommented:
Well, the general solution is given in http://en.wikipedia.org/wiki/Rotation_matrix - since it's 90° (or, p/2), that should be pretty straightforward.
jkrCommented:
Sorry, that didn't accept the greek letter for PI - make that PI/2 then
Infinity08Commented:
>> since it's 90° (or, p/2), that should be pretty straightforward.

It's so straightforward that there's no need for calculations even.

Rotate point (1, 2) 90 degrees clockwise around the origin to get (2, -1).
Rotate point (2, -1) 90 degrees clockwise around the origin to get (-1, -2).
Rotate point (-1, -2) 90 degrees clockwise around the origin to get (-2, 1).
Rotate point (-2, 1) 90 degrees clockwise around the origin to get (1, 2).

See a pattern ? ;)
vixenmrbAuthor Commented:
Also - I think this has to do with the prob itself. Show this be adding the number to the orig coordinate for example if the orig for x is 1 and y is 1 .. I enter to move it 4 and 5. Should the output be for the new coordinates be 4 and 5 or should it be 5 and 6? Based on the formula it seems like the new coord output should be 5 and 6. This is not what is happening.
vixenmrbAuthor Commented:
IKR gave me exactly what I needed to correct the errors. I still had to work on the rotation part a little more but Infinity08's info also help.. Thanks all...
Infinity08Commented:
>> I enter to move it 4 and 5. Should the output be for the new coordinates be 4 and 5 or should it be 5 and 6? Based on the formula it seems like the new coord output should be 5 and 6. This is not what is happening.

Take a closer look at what exactly you are doing in the move function. What are the I/O lines doing there ?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.