Question: c++ program: Visual Studio/XCode program Create a Point2D class. It should have the fields x and y, a default constructor that puts the point at

c++ program: Visual Studio/XCode program

Create a Point2D class. It should have the fields x and y, a default constructor that puts the point at the origin and a constructor with arguments which puts the point at the given coordinate. It should have getters and setters for x and y, and four more member functions:

moveHorizontally which takes a number (positive or negative) and moves the point along the x axis by that many units moveVertically which takes a number (positive or negative) and moves the point along the y axis by that many units moveToOrigin which moves the point to 0,0 printLocation which prints the current location (e.g. Point at (2, 3) ) Create a few point instances and exercise their behaviors. Set their coordinates, move them along the x/y axis, print their location.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!