Computer Science Homework Solutions
Problem
#31726

Building Classes

The point-slope equation of a line having slope m and pasing through pint P with coordinates (x1, y1) is y-y1=m(x-x1).
a. Write a class for a CartesianPoint, described by its x- and y- coordinates, with all appropriate operations on such objects.
b. Write a LineSegment class, described by two CartesianPoint endpoints.  In addition to the usual operations, this class should provide operations to compute:
-the midpoint of the line segment joining two points and
-the equation of the perpendicular bisector of this line segment.
c. Write a class for Line, described by its slope and a point on the line, with opeations that find the point-slope equation of the line and find the slope-intercept of the line.
d.  Write a program to read the point and slope information for two lines and to determine whether they intersect or are parallel.  If they intersect, find the point of intersection and also determine whether they are perpendicular.

Solution
What is this?
By OTA - Overall OTA Rating
Suraj Joshi, PhD (IP) - 4.7/5
Purchase Cost Now
$2.19 CAD (was ~$27.93)
Included in Download
  • Plain text response
  • Attached file(s):
    • BM.zip
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Building Classes - The point-slope equation of a line having slope m and pasing through pint P with coordinates (x1, y1) is y-y1=m(x-x1). a. Write a class for a CartesianPoint, described by its x- and y- coordinates ...
  • Photoelectric effect experiment - 2. In the photoelectric effect experiment, light photons strike a photoelectric material in a phototube and electrons are emitted with a certain kinetic energy. If the stopping energy of the electrons ...
  • Automata and Computability - Let A = (attached) R and S are regular expressions and L(R)  L(S) . Show that A is decidable.
  • Automata and Computability - Show that the collection of Turing-recognizable languages is closed under the operations of a. union. b. concatenation. c. star. d. intersection
  • Automata and Computability - Show that the collection of decidable languages is closed under the operations of a. union. b. concatenation. c. star. d. complementation. e. intersection
Browse