68 774
Assignments Done
Successfully Done
In January 2019

Answer to Question #64693 in C++ for Natalie

Question #64693
Design a class Line that implements a line, which is represented by the formula y = ax+b. Your class should store a and b as double members and write a member function intersect() such that L.intersect(K) returns x coordinate of unique point where lines L and K intersect. If no point, the function should throw an appropriate exception.
Function should throw an exception if two lines are same or are parallel and hence have no point of intersection. For this, you will need subclasses EqualLines and ParallelLines of the class RunTimeException (declaration on page 97 of the text). The message part of the exceptions should be "The lines are equal: infinite intersection" for EqualLines and "The lines are parallel: no intersection" for ParallelLines. When either exception is caught, the messages will be printed. This will occur in the program that uses the Line class. The class methods should not produce any output.
Expert's answer
Dear Natalie, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions