Question: 5 photos Effective commenting and tabbing will affect your grade. The style of your program should follow the style of the sample programs in the
Effective commenting and tabbing will affect your grade. The "style" of your program should follow the style of the sample programs in the course notes. Your program should have the file name, your name, creation and last modification dates and a brief description of the program in the comments at the top of the program. The declaration of every variable shoud have a comment A 2D vector (u, ) has its base at the origin in the cartesian coordinate system, ie. the z-y axes, and its tip (or arrow) at z = u and y = u. Thus, a 2D vector can be represented simply as an (r,y) point in the cartesian coordinate system. Write a program that reads in a pair of 2D vectors and a scalar value and then applies the following vector operations: addition, subtraction, scalar multiplication, and perpendicularity. The main routine of the program is already provided in vector2D_template.cpp (which you copied into vector2D.cpp). Your task is to add eight functions read vector O, vector lengthO vrite vector, vector add), vector_subtract , scalar multO, normalize, and perpendicular so that the program produces the desired results. 1. Write your code incrementally. I HIGHLY SUGGEST that you write each function one at a time as deseribed in the following steps. After you have written a solution to a particular function, you should compile, run, and test your code before moving to the next step. 2. DO NOT MODIFY ANY OF THE CODE in procedure main 3. DO NOT change the global constant called EPSILON defined at the top. 4. You will use the global constant EPSILON whenever you need to determine the equality of two values of type double (Please study the lecture notes before you continue). For example, if a and b are values of type double you can use the following condition to determine that they are equal: abs(a-b)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
