Question: Vertical Lines The program should avoid a divide by zero error by checking for vertical lines. In a vertical line: x 2 = x 1
Vertical Lines
The program should avoid a divide by zero error by checking for vertical lines. In a
vertical line: x x; consequently: x x
Note: If one of the lines is found to be verticalhorizontal all the program needs to do is
check to see if the other line is horizontalvertical to determine whether they are
perpendicular or not.
Output
The program output should be either:
Lines are perpendicular
Or
Lines are not perpendicularInstructions
Write a Java program to determine whether two straight lines are perpendicular. The
program must prompt the user for the values of coordinates for two points of each
line. Coordinate figures must be read as integers.
Example: in the graph below, the line is defined by the pairs: and ;
whereas the line CD is defined by and
Premises
For a line represented by two points: and the slope of such line,
m is determined by:
Given two lines with slopes m and m respectively, the lines are perpendicular if
the product of their slopes yields :
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
