solutions28 - CSCI-1100 Computer Science Rensselaer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science Rensselaer Polytechnic Institute Spring 2004 Studio 28 -- Solutions File XmasTree.h #include "Canvas.h" #include "Tree.h" // Draws a Christmas tree class XmasTree : public Tree { public: // create a tree const int x, const int y); void setColors(color c1, color c2); // tree size (default: 100) void draw(); // draw the tree private: color color1; // first color for decorations color color2; // second color for decorations }; File XmasTree.cpp #include "Canvas.h" #include "XmasTree.h" using namespace std; // implementation of the XmasTree constructor { color1 = CanvasColor::RED; color2 = CanvasColor::BLUE; } // change the colors of the decorations void XmasTree::setColors(color c1, color c2) { color1 = c1; color2 = c2; } // draw the Christmas house void XmasTree::draw() { int leftX, leftY; // triangle left point int rightX, rightY; // triangle right point
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
int k; // loop variable Tree::draw();
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

solutions28 - CSCI-1100 Computer Science Rensselaer...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online