Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help asap (c++) Design and write a Point class, simulating a 2-dimensional point. The Point class needs to implement the following as member functions:

need help asap (c++)

image text in transcribed

image text in transcribed

Design and write a Point class, simulating a 2-dimensional point. The Point class needs to implement the following as member functions: 1. return the distance from the point to the origin 2. return the angle the point makes with the positive x-axis (Hint: the atan2() function is good at finding this - see the docs, here: http://www.gnu.org/software/libc/manual/html_node/Inverse-Trig-Functions.html.) 3. Translate the point in 2D space: to move a Point with coordinates (x,y) by an amount (dx, dy), so that the new coordinates are (x+dx, y+dy) 4. rotate the point through a certain angle about the origin 5. rotate the point through a certain angle about another point [ Hint: to rotate your point (x,y) about a point (x0, yo) try translating the point by an amount (-x0,- yo), then rotating it about the origin, then translating it back by an amount (+x0,+YO). ] 6. A printxy() function, which prints the point's x and y coordinates nicely on screen. 7. A printpolar() function, which prints the point's polar coordinates (r and theta) nicely on screen. Test harness Use the test harness below to test your class: int main() { // origin to rotate around const Point p(1.0, 0.5); Point p1(3.0,5.0); note const cout

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions