triangles - File triangles.cpp Created by Patch Havanas...

This preview shows page 1 - 2 out of 4 pages.

/* File: triangles.cpp Created by: Patch Havanas Creation Date: 11/25 Synopsis: Reads in a right triangle, calculates it's attributes, reads in a scale, and prints new attributes */ #include <iostream> #include <cmath> using namespace std; class Point { private: double px; double py; public: void setX(const double x); void setY(const double y); double getX() const; double getY() const; }; class Triangle { private: Point blPoint; double length, height; public: // member functions void setBottomLeftX(const double x); void setBottomLeftY(const double y); void setLength(const double inLength); void setHeight(const double inHeight); Point getBottomLeft() const; Point getBottomRight() const; Point getTopLeft() const; double getLength() const; double getHeight() const; double perimeter() const; double hypotenuse() const; void scaleLength(const double sx); void scaleHeight(const double sy); void display() const; }; // FUNCTION PROTOTYPES GO HERE: void read_triangle(Triangle & tri); int main() { // Define local variables Triangle tri; double sx, sy; //Prompt the user for triangle information and fill Class Triangle object, tri, //with this information

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture