CS 111 - INTRO TO COMPUTING, Spring 2018

Lab 4

Lab Assignment

Due: Wednesday, 2/14/2018 by 11:59 pm

For this lab assignment, complete the following:

  1. Using the turtle drawing features, create a picture that contains a set of concentric shapes. The shapes can be any that you want (squares, octagons, triangles, etc). For this lab, each smaller version of the shape must be completely inside of the next larger size of the shape. An example of this is using a square as follows:

    or
    or the following using a hexagon

    The above have the center of each shape in the same place while the following two do not have the center in the same place.

    or

    Your final picture MUST have the shape repeated at least 8 times with the sides of each shape being slightly longer that the one closer to the center. You MUST use a loop to draw the shape at least 8 times. The loop variable that keeps track of how many shapes to draw MUST be used to calculate the length of each side.

    The key to this lab is to move the turtle to the proper location (with the pen UP!) after one shape is drawn and before the next shape is drawn. For the shapes shown above, the starting/ending point of each shape is the lower left corner. The turtle moves left by a certain amount and then down by that same amount to get in position to draw the next shapes.

    While you do NOT need to draw a square for this assignment, using a square is by far the simplest way to complete the assignment.

  2. Your drawing of the shape MUST BE DONE IN ITS OWN FUNCTION! This function is to draw the shape once every time it is called. Thus to draw eight shapes, you will need to call this function eight times from your main( ) function. Since the length of the sides of the shape must change with each drawing, you will also need to send the function a parameter that indicates the length of each side of the shape.

  3. The picture for the drawing can initially be blank or be a picture selected by the user. After you are done drawing the picture, you are to prompt the user for a filename and store the picture in that file using the writePictureTo ( ) function from the JES library. You should use the pickAFile() function from the JES library when prompting the user for the filename to store the picture.

  4. Be sure to comment at the top of your file to contain the following:
    • your name
    • your NET-ID
    • day and time of your CS 111 lab section (i.e. Monday at 1:00)
    • A description of the project.

How assignments should be submitted

You are also to submit the python file electronically via the Assignment link in Blackboard for this lab. You are to name your file with the lab number and your netID. Please only submit source code file (the .py file).

Topic revision: r1 - 2018-02-09 - 15:10:24 - Main.troy
 
Copyright 2016 The Board of Trustees
of the University of Illinois.webmaster@cs.uic.edu
WISEST
Helping Women Faculty Advance
Funded by NSF