text: hey guys, I have an assignment that has the following requirements:
  1. Write a class Line which represents a line in 2D
  2. Two constructors: one with slope and intercept
  one with (x1, y1) (x2, y2)
  3. Member function findY(double) which for a given line
  takes an x-value and returns the y-value
  4. Write short main program which exercises the class and
  show output
  Below is what I did...I would appreciate any suggestions or comments about code, and if you think this is enough for the given requirements. Thanks,
  axon
  Code:/* Author: * Class: CS201 * Date: 09.08.03 * Assgn: Homework 0 * System: g++ and MSVC++ */ #include <iostream> using namespace std; class Line { public: //constructors Line( double newSlope, double newIntercept );; }; //-------------------------------------- int main() { double x = 0; double y = 0; Line slopeAndIntercept(1, 2), coordinates(2, 4, 3, -1); slopeAndIntercept.output1(); coordinates.output2(); x = 12; cout << "\nCalculating y-coordinate when x = 12: " << endl; y = slopeAndIntercept.findY(x); cout << "When x = 12, y = " << y << endl; return 0; } //----------------------------------- //defining functions and constructors) { return (slope*x + intercept); }