Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I understand the program is long and tedius, I need help any way possible. Write in C + + please. Will like the answer if

I understand the program is long and tedius, I need help any way possible. Write in C++ please. Will like the answer if helpful!!
Write a class Point that represents a point on the screen. Hence it has an x and y coordinate (which are integers).
You should write a class definition and the following functions (you must decide if they are members or
friends).
(a) A constructor which is passed two integers, consider whether to use default values.
(b) A copy constructor.
(c) A translate function which is passed a Point and changes the coordinates using the passed in Point. If the
original point is (x,y) and the point (a,b) is passed in then the new coordinates (x',y') are given by the formulas:
x'=x+a,y'=y+b
Note, this function can be implemented using operator overloading.
(d) A move to function. This function is passed a Point and moves the original point to the passed in Point.
(e) A rotate function which is passed an angle and rotates the point by that amount. If the original point is (x,y
and the angle of rotation is , then the new coordinates (x',y') are given by the formulas:
x'=xcos-ysin,y'=xsin+ycos
(f) A distance function that gives the distance between two points. The formula for the distance between (x,y)
and (x',y') is:
(x'-x)2+(y'-y)22
(g) A function that determines if a point is on a given line. The information for the line would be passed in as a
slope and a specific point on the line. Hint: use the point-slope formula for a line.
(h) Functions to access the x and y coordinates. There should be three such functions. One that returns the x-
coordinate, one that returns the y-coordinate and one that returns the Point.
(i) Functions to modify the x and y coordinates.
(j) Overload the assignment operator.
(k) A function called invert that switches the x and y coordinates.
(l) A function that is passed two points and finds the midpoint between them.
(m) A function to convert the point (x,y) into polar coordinates (r,). The conversion equations are:
r=x2+y22,=tan-1(yx)
(n) Overload the input and output operators.
image text in transcribed

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago