Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(Please give all the solutions and steps, if you give the answer by picture please post a clear picture. Please don't answer the question if
(Please give all the solutions and steps, if you give the answer by picture please post a clear picture. Please don't answer the question if you can't do all the questions, THANKS).
1. (50 points) Write the definitions for the functions of the class below that stores infor mation about a 2-D vector. The class should have functions to set and get the x and y integer components. Overload theoperator to return the dot product of two vectors as (A x B) +(Ay x By). Overload the operator to also return an integer multiple of the given vector. Overload theoperator to check whether two vectors have equal magnitudes, where the magnitude is given as yA + A function. The class also needs to track how many vector instances are available at any given time using the static variable. using the calculateMagnitude class Vector2D public Vector2DO; //Default constructor Vector2D(int newX, int newY); //Additional constructor Vector2D(int neXValue); //Horizontal vector constructor, y-coordinate is zero friend bool operator (const Vector2D&k vector1, const Vector2D&vector2); friend const int operator * (const Vector2D& vectorl, const Vector2D& vector2); friend const Vector2D& operator * (int n, const Vector2D& vector1); void setX(int new%); void setY(int newY); int getXO; int getYO; double calculateMagnitude ); private int x; int y; static int numberOfVectors; b: int Vector2D: :numberOfVectors 0; (a) (5 points) Vector2D: : Vector2DC) I //Set x and y to 0, and increment the number of vectorsStep 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