Engineering 3891 Assignment 6 Header File

 

/***********************************************************************
MEMORIAL UNIVERSITY OF NEWFOUNDLAND
Faculty of Engineering and Applied Science
Engineering 3891(Advanced Programming)
Assignment #6 Instructor: Michael Bruce-Lockhart

Out: 00.10.27 Due: 00.11.03.08:50
***********************************************************************/
struct point{
double x,y;
};

/* Flip definitions. NOTE - a horizontal flip means in the
horizontal plane (therefore ABOUT the vertical axis). And
vice versa. */
enum flip{NONE,HORIZONTAL,VERTICAL,BOTH};

/* An object of class Vector is deemed to be a vector on the
two dimensional plane from the origin to the point (x,y).
Methods (built-in functions) associated with a Vector object
sets it to a value, returns the present value, scales it,
rotates it or reflects it about either the x or y axis (or
both). There are also methods to add or subtract another
vector to it. However these operations can only be carried
out when both operands are vectors.
Your task is to provide the actual code for the methods
associated with vector. As always, these should be in a file
called "assign6.cpp" which should begin with the line
#include "assign6.h"

HINTS:
1. math functions may be used by including <math.h>
2. the code for this class is VERY simple.


*/
class Vector{
public:
Vector(double x = 1.,double y = 0.); // initialize loc to (x,y)
// Accesor
point get() const; // return loc

void scale(double s); // Scale vector by s
void rot(double a); // rotate vector a degrees about origin
void reflect(flip f); // reflect vector as directed by f
void add(const Vector& v); // add v to the vector
void subtract(const Vector& v); // Subtract v from the vector
private:
point loc; // Endpoint
};