Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please solve this in C++ programming. ASAP.I posted this question hours ago and

ID: 3765794 • Letter: P

Question

Please solve this in C++ programming. ASAP.I posted this question hours ago and someone solved it wrong. please provide me with the correct answer. Thanks.

The equation of a line in standard form is ax + by c, wherein both a and b cannot be zero, and a, b, and c are real numbers. If b 0, then-a/b is the slope of the line. Ifa 0, then it is a horizontal line, and f b 0, then it is a vertical line. The slope of a vertical line is undefined. Two lines are parallel if they have the same slope or both are vertical lines. Two lines are perpendicular if either one of the lines is horizontal and the other is vertical or the product of their slopes is-1. Design the class lineType to store a line. To store a line, you need to store the values of a (coefficient of a),b (coefficient of y), and c. Your class must contain the following operations a. If a line is nonvertical, then determine its slope b. Determine if two lines are equal. (Two lines apr + b-Y = c1 and a2x + b2 = c2 are equal if either al = a2, b1 b2, and q c2 or al = ka2. -kb2. and ke for some real number k.) . Determine if two lines are parallel. d. Determine if two lines are perpendicular. e. If two lines are not parallel, then find the point of intersection Add appropriate constructors to initialize variables of lineType. Also write a program to test your claSS Point of intersection means the point at which two lines intersect. These two lines are represented by the equation ax2+bx+c0 and apx+ bx+ c2 0 respectively. Given figure illustrate the point of intersection of two lines. ax+by 20 (x, y) We can find the point of intersection of three or more lines also. By solving the two equations, we can find the solution for point of intersection of two lines. The formula for point of intersection is b1C2 -b2c1 a1b2 a2b1' a2C1 -a1C2 a1b2 a2b

Explanation / Answer

Answer:

#include <iostream>
#include <math.h>

void main()
{
float k, p, l, q;
float x1, y1, x2, y2;
float dx, dy;
float intersect_x, intersect_y;

cout << " Program to find the intersecting point of two lines: ";

cout << "Enter Line1 - --->X1: ";
cin >> x1;

cout << "Enter Line1 ----> Y1: ";
cin >> y1;

cout << "Enter Line1 ---> X2: ";
cin >> x2;

cout << "Enter Line1 ---> Y2: ";
cin >> y2;

dx = x2 - x1;
dy = y2 - y1;

k = dy / dx;

p = y1 - k * x1;


cout << "Enter Line2 - --->X1: ";
cin >> x1;

cout << "Enter Line2 -----> Y1: ";
cin >> y1;

cout << "Enter Line2 ---> X2: ";
cin >> x2;

cout << "Enter Line2 ----> Y2: ";
cin >> y2;

dx = x2 - x1;
dy = y2 - y1;

l = dy / dx;
q = y2 - l * x2;

cout << "Equation of line1 Is";
cout << k << "X " << ((p < 0) ? ' ' : '+') << p << " ";

cout << "Equation of line2 Is ";
cout << l << "X " << ((q < 0) ? ' ' : '+') << q << " ";

if( (k - l) == 0)
cout << "No Intersection between the lines ";
else
{
intersect_x = (q - p) / (k - l);
intersect_y = k * intersect_x + p;
cout << "Intersecting Point Is Given As ";
cout << intersect_x;
cout << ",";
cout << intersect_y;
cout << " ";
}
}