Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement C + + of the LineType class to represent a line as follows: A . Implement a class ( or struct )

Design and implement C++ of the LineType class to represent a line as follows:
A. Implement a class (or struct) called Point to represent a point (x,y). The x
and y members may be public. You may nest the declaration of Point
inside of LineType, but it is not required.
B. Implement a class called LineType to represent a line. The only member
variables should be two variables of type Point. Include the following
functions in your LineType class:
a 4-argument constructor that takes four values to specify the 2 points
(you 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 non-vertical lines).
parallel to return true if the line is parallel to another line, false
otherwise.
It 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

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

Genetic Databases

Authors: Martin J. Bishop

1st Edition

0121016250, 978-0121016258

More Books

Students also viewed these Databases questions