Related questions with answers
Question
Design the class linetype to implement a line so that the class lineType:
- Overloads the stream insertion operator, , for easy output.
- Overloads the stream extraction operator, , for easy intput. (The line is input as .
- Overloads the assignment operator to copy a line into another line.
- Overloads the unary operator , as a member function, so that it returns true if a line is vertical; false otherwise.
- Overloads the unary operator -, as a member function, so that it returns true if a line is horizontal; false otherwise.
- Overloads the operator , as a member function, so that it returns true if two lines are equal; false otherwise.
- Overloads the operator , as a member function, so that it returns true if two lines are parallel; false otherwise.
- Overloads the operator , as a member function, so that it returns true if two lines are perpendicular; false otherwise. Write a program to test your class.
Solution
VerifiedAnswered 2 years ago
Answered 2 years ago
Step 1
1 of 7Setup:
#include
using namespace std;
class lineType{ public: bool vertical() const; void slope(); bool equal(lineType) const; bool parallel(lineType) const; bool perpendicular(lineType) const; void intersection(lineType); void printSlope() const; void printIntersection() const; lineType(float = 0.0, float = 0.0, float = 0.0);
friend ostream& operator << (ostream& osObject, const lineType& cObject);
friend istream& operator >> (istream& isObject, lineType& cObject);
const lineType& operator = (const lineType&);
bool operator + ();
bool operator - ();
bool operator == (const lineType& b);
bool operator || (const lineType& line);
bool operator && (const lineType& line);
private:
float a;
float b;
float c;
float sl;
float xi;
float yi;
};
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
More related questions
- computer science
- computer science
1/4
- computer science
- computer science
1/7