Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Writing a class with header files C++

luckens-victor
luckens-victor 


I will attach the file with the instructions Also I will attach a zip file which includes a skeleton of the code which makes this pretty easy. HERE IS THE GRADING RUBRIC: RUBRIC: 220 points total - 20- Good Comments with Pre and Post Conditions!! (Point Class) 10 pts- I can construct points using a default constructor and one where I pass in points 10 pts- I can construct a point by using another point 10 pts- Setter for my x and y of my point 10- I can translate my point by a given amount 10- I can scale my point by a given amount 10- I can reflect my point by a given amount 10- I can rotate my point counter clockwise around the origin by some angle 10- assignment operator correctly overloaded 10- comparison (==) is correctly overloaded 10- cin and cout overloaded, you can do cin>>x>>y if you want to input multiple values (Line Class) 20- Line class uses point class functions whenever it can DO NOT REINVENT THE WHEEL i.e. the Line Translation is just translating the points of the point class... 10- Three constructor functions, default for x-axis, line passing through (0,0) ie.- one point passed in, and a constructor wherein two points are passed in and that makes our line 10- Copy constructor wherein I initialize my line based on a line that was passed in 10- Slope function returns the correct slope, note that if x1=x2 should be undefined or infinite slope 10- Translation for line works 10- Reflection works for line 10- =, == overloaded correctly, think a little deeply about this...i.e. == occurs if the y-intercept and the slope are equal so you might make a PRIVATE member function that helps you calculate the y intercept if you'd like. The y-intercept occurs when x=0-- so solve the equation for x=0 and you have it! 10- CIN overloaded correctly. 10- COUT overloaded correctly. COUT is a bit tricky so think about it --> line equation- pick a point on your line (x1 y1), m is our slope y - y1 = m(x - x1) https://www.mathsisfun.com/algebra/line-equation-point-slope.html you can easily solve this for y y= m*x-m*x1+y1 Attachments Tags
Clarifications

Answers

Writing a class with header files C++

felo
felo 



Find attached program Attachments
csci2270-hw1.zip (5 K) Download




Preview
OR x=x OR y=y double m = l.slope(); if (m == 0) { os << "x = " << l.start.get_x(); } else if (l.start.get_x() - l.end.get_x() == 0) { os << "y = " << l.start.get_y(); } else { double b = l.start.get_y() - m * l.start.get_x(); os << "y

Preview
a vertical line. */ friend std::istream& operator >> (std::istream& is, line& l); /* same rules that apply for the points apply for the line. */ double slope() const; /* returns the slope of the line. If the line is vertical... god help you. */ void translate(double dx, double dy); /*

Preview
point::translate(double dx, double dy) { x += dx; y += dy; } void point::scale(double factor) { x *= factor; y *= factor; } void point::reflect_x() { y *= -1; } void point::reflect_y() { x *= -1; } void point::rotate(double radians) { x = x * cos(radians) - y * sin(radians); y = x * sin(radians) +

Preview
if no arguments are given.*/ point(const point& p); /* You can also use a copy constructor to make a point. Whoohoo, we're flying now. */ double get_x() const; /* because we don't want x to be a public variable. */ double get_y() const; /* see above, s/x/y/ */ void set_x(double

Screenshots
Purchase Answer

Mr.

felo
felo 



1 Attachments
Screenshots
Purchase Answer