Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4 . ( 4 pts ) A line in two dimensional space may be defined using two points ( x 1 , y 1 )
pts A line in two dimensional space may be defined using two pointsxy and xy where x y x and y are real numbers. If y y then itis a horizontal line, and if x x then it is a vertical line. If the line is notvertical then the slope of the line is yyxx The slope of a vertical lineis infty undefined Two lines are parallel if they have the same slope or if bothare vertical lines.Design and implement the LineType class to represent a line as follows:A Implement a class or struct called Point to represent a point xy The xand y members may be public. You may nest the declaration of Pointinside of LineType, but it is not required.B Implement a class called LineType to represent a line. The only membervariables should be two variables of type Point. Include the followingfunctions in your LineType class: a argument constructor that takes four values to specify the pointsyou may assume the provided values will yield two different points isHorizontal to return true if the line is horizontal, false otherwise. isVertical to return true if the line is vertical, false otherwise. slope to compute and return the slope for nonvertical lines parallel to return true if the line is parallel to another line, falseotherwiseIt is ok for slope to cause a runtime error if the line is vertical.It is NOT ok for parallel to cause a runtime error.
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