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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started