Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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 using std::cout; using std::cin; using std::endl;

#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

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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions