CSci 150: Foundations of computer science I
Home Syllabus Assignments Tests

Assignment 1: Building a house

Due: 2:00pm, Thursday, September 3. Value: 30 pts. Submit your saved file using the Sauron Submission System. [instructions]

Note: You will be assigned to work with another student on this assignment, and you should submit your solution to the assignment together. Unless you're told otherwise, working with another student will be optional for all future assignments in this course.

After starting Jigsaw (instructions), your assignment is to write a program to draw a house using the Turtle class. The house should vaguely resemble the picture at left below, including a door, window, and chimney; the window should not be connected to the rest of the drawing. Your drawing should use at least two different colors for the drawn outlines. Your picture need not be centered within the 200×200 window, nor need it include such elements as a sun, smoke, a tree, or children on a see-saw.

After you have completed the assignment, you should submit it to me via the Sauron Submission System. [instructions]

   
Source: a Faroe Islands stamp at Wikimedia Commons. My solution.

For reference, below is a table of some useful colors as well as the pyramid-building program we saw in class.

new Color(255,0,0) cherry red
new Color(255,255,0) yellow
new Color(0,255,0) lime green
new Color(0,255,255) cyan
new Color(0,0,255) royal blue
new Color(255,0,255) magenta
new Color(255,255,255) white
new Color(192,192,192) silver
    
new Color(128,0,0) maroon
new Color(128,128,0) olive
new Color(0,128,0) dark green
new Color(0,128,128) teal
new Color(0,0,128) navy blue
new Color(128,0,128) purple
new Color(128,128,128) gray
new Color(0,0,0) black
public class BuildPyramid extends TurtleProgram {
    public void run() {
        Color mauve;
        mauve = new Color(102, 51, 128);

        Turtle ramses;
        ramses = new Turtle(50, 150);
        ramses.setPenColor(mauve);
        ramses.forward(100);
        ramses.left(120);
        ramses.forward(100);
        ramses.left(120);
        ramses.forward(100);
        ramses.hide();
    }
}