Question
The equation of a line in standard form is ax + by = c, where a and b both cannot be zero, and a, b,
The equation of a line in standard form is ax + by = c, where a and b both cannot be zero, and a, b, and c are real numbers. If b0, then a/b is the slope of the line. If a=0, then it is a horizontal line, and if 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 one of the lines is horizontal and another is vertical, or if the product of their slopes is -1. Design the class LineType to store a line. To store a line, you need to store 2 Points. Your LineType class must contain the following operations:
Constructor that takes 2 parameters each of type Point
Constructor that takes 4 parameters each of type int that represent x1, y1, and x2, y2 for each point respectively.
Accessors and mutators for the class variables
toString to represent the line in the form y = m x + c; where m is the slope and c is the Y-intercept.
getSlope; If a line is nonvertical, then determine its slope. The slope is calculated by: m = change in y / change in x; or m = (y2-y1) / (x2-x1)
Equals; Determine if two lines are equal (Two lines y = m1 x + c1 and y = m2 x + c2 are equal if both m1=m2 and c1=c2)
isParallel; Determine if two lines are parallel. isPerpendicular; Determine if two lines are perpendicular intersection; If two lines are are not parallel, then find the point of intersection. Write a program to test your class.
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