Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Needs help with the class specification. The vect.h file CIS 125 C++ Programming

ID: 3699583 • Letter: N

Question

Needs help with the class specification. The vect.h file CIS 125 C++ Programming Mod 7 Assignment This program will be due in 2-1/2 parts. The first part will be (vect.h) file (this is the half part.) Next we will begin by testing out the vector class much like you with the Inventory class. We will then "use" our fully functioning vector class in a program. be announced creating your interface to the Vector class Due dates to Purpose: To gain more understand of classes by creating a robust class using overloaded constructors, overloaded operators that can be used with multiple programs. For this assignment you will be writing a class and two "driver" programs that will use the class. The first "driver" program will test (ALL of) the features of the class. The second program will run a little simulation program (The dizzy kid, random walk) Write a Vector Class. A Vector is a term used in engineering and physics and is a quantity that has both Magnitude and direction. We can represent the Vectors in rectangular components (x and y values) or polar components magnitude (length) and direction (angle). Interface: . Your class specification will be stored in the vect.h file Your Vector class should have at least 2 constructors A default one that sets all data members to zero and sets the mode to rectangular. One that takes 2 arguments to set the x and y values (they should be floating point numbers) (Extra Credit) Add another constructor that takes both polar and rectangular components. It will need a 3°d argument to determine which "mode " you want to use. Also it could work if you only pass it the first 2 arguments, the third one should be defaulted to the rectangular mode Although you may not need it, create the destructor. Your code can be a just a "placeholder" and add code later (if we determine that we need it.) o o o o . Mutators o You should be able to set the "mode" to polar or rectangular. This will be primarily used to alter your output of you display and stream insertion operator (

Explanation / Answer

//this might be the solution

#include <iostream>

using namespace std;

class vector{

private:

double x,y;

double polar;

public:

vector(double a,double b){

this.x=a;

this.y=b;

}

vector(double theta,double mag,int a=1){

this.polar=theta*mag*a;

}

void setVector(int flag,double x,double y){

if(flag==1){

this.x=x;

this.y=y;

}

else if(flag==2){

this.polar=x*y;

}

}

int getx(){

return this.x;

}

int gety(){

return y;

}

double getpolar(){

return polar;

}

}

int main() {

vector v=vector(5,6);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote