Write a java program that asks the user to enter the coordinates of 4 points that draw two different lines. The program has to display whether these two lines are parallel, perpendicular, or neither according to the following formula: Slope y2-y1 x2-x1 If the slopes of both lines are equal, the two lines are parallel If the product of both slopes is equal to -1, the 2 lines are perpendicular. Otherwise, the two lines are neither parallel nor perpendicular.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question
Write a java program that asks the user to enter the coordinates of 4 points that draw two different lines. The program has to display whether these two lines are parallel, perpendicular, or neither according to the following formula: Slope y2-y1 x2-x1 If the slopes of both lines are equal, the two lines are parallel If the product of both slopes is equal to -1, the 2 lines are perpendicular. Otherwise, the two lines are neither parallel nor perpendicular.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning