solutions10 - CSCI-1100 Computer Science I 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 I Rensselaer Polytechnic Institute Spring 2004 Studio 10 -- Solutions 1. #include "Canvas.h" // A Logo Turtle-like Pen class for drawing on a canvas class Pen { public: Pen (const Canvas& can); // create a pen for a canvas void GoTo(double x, double y); // move pen to a new position void Move(double dist); // move ahead a specified distance void Turn(double degrees); // turn pen counterclockwise void Direction(double angle); // turn pen to specified direction double GetXLoc(); // return pens current x coordinate double GetYLoc(); // return pens current y coordinate private: Canvas c; // canvas for pen double xloc; // current x location of pen double yloc; // current y location of pen double direction; // current direction of pen }; Pen.h
Background image of page 1

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

View Full DocumentRight Arrow Icon
#include "Canvas.h" #include "pen.h" #include "mathutils.h" #include <cmath> using namespace std; // implementation of the Pen constructor { xloc = 0.0; yloc = 0.0; direction = 0.0; } // go to a specified coordinate
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 / 3

solutions10 - CSCI-1100 Computer Science I 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