Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java Exercise 2: A line can be defined by two points, P1: (x1,71) and P2: (x2, 72). The slope of the line can be

image text in transcribed

in java

Exercise 2: A line can be defined by two points, P1: (x1,71) and P2: (x2, 72). The slope of the line can be determined by ya) , given that x2 x1 +0. If yz - y1 = 0, then it is a horizontal line, and if X2 X1 , 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 one of the lines is horizontal and another is vertical, or if the product of their slopes is -1. Design the class line Type to store a line. To store a line, you need to store two Point objects. Your class must contain the following operations: a) If a line is nonvertical, then determine its slope. b) Determine if two lines are equal. c) Determine if two lines are parallel. d) Determine if two lines are perpendicular. Add appropriate constructors to initialize variables of line Type. Also write a program to test your class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of the application procedure.

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago