Question: need help on c++ program please here's code: // TestThreeDVec.cpp // // COSC1030, Sp 2017 // Program 13 // // Test program to demonstrate and
need help on c++ program please



here's code:
// TestThreeDVec.cpp // // COSC1030, Sp 2017 // Program 13 // // Test program to demonstrate and validate desired behavior // of the new C++ class ThreeDVec . // #include
#include "ThreeDVec.h"
int main() { ThreeDVec A; cout
ThreeDVec B(3,4,5); cout
ThreeDVec D; cout > D; cout
return 0; }
Your boss needs a C++ data class which represents three-dimensional vectors (commonly used in physical sciences and engineering to assist in the analysis of phenomena including forces and electromagnetic fields). 1. The class you design must duplicate precisely the public interface shown in the at- tached main test program, TestThreeDVec.cpp. The particulars of the implemen- tation are vours to define. Note that this time. you have to create both the .h and the .cpp files. 2. This defines a vector in a 3D space NOT a STL vector-type object. These 3D vectors only ever store three values, an r, y, and 2. 3. Examples of the common notation and operations associated with such vectors are as follows: (a) Assume two vectors M Gr1, 1, 21) and N (z2, y2, 22) The scalar elements zi, yi, and zi should be assumed to take on real (floating point) values. (b) The sum is defined as: M +N r2, 1 1/2, 21 22), a vector quantity. T1 (c) The magnitude is defined as llMI Varf yf 2?, a scalar quantity. (This is can also be written M (zi yi 21)1/2.) (d) The dot product is defined as: M *N (z yit/2 2122), a scalar quantity. a e) The cross product is defined as: M N (y122 212/2, 21T2 T122, T12/2 13), a vector quantity. (Yes, the cross product usually uses x but we are using an operator we can overload easily
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
