Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions