Question: using C++ Create a class called line to hold two X,Y coordinate pairs. Create a project Create a main() to test the following specified class.

using C++

Create a class called line to hold two X,Y coordinate pairs.

Create a project Create a main() to test the following specified class.
Create the class to hold two x,y coordinate pairs. Store the coordinate pairs as doubles. 

Since two coordinate pairs can describe a line solve the standard y = mx + bequation for slope and y-intercept (b).

? Create two constructors for this line. One an empty one and one the takes are the parameter

Create a mutator function that will allow the user to update the parameters of the line class.

? Create a method to calculate and return the slope.

? Create a method to calculate and return the y-intercept.

? Create a method to determine if the line is vertical. It should

 return a bool. 

? Create a method to determine if the line is horizontal . It

 should return a bool. 

? Create a method to display the parameters of the line.

Finally, treating these coordinate pairs as the lower and upper

coordinates of a rectangle calculate/display the width, height and area of this rectangle.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!