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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started