A4-Select a Shape

On This Page


Overview

There are three parts to this assignment:

  1. Review Exercises:

    First make sure you have completed and turned in the exercises from lesson 4. Then complete the exercises in CodeLab 4. These exercises will help prepare you for the problem-solving program and should be completed first. You can look at solutions if you miss your first attempt.

  2. Problem Solving Program:

    Complete the programming project following the Program Specifications listed below. You may make extra credit additions to this program as outlined in the section on Extra Credit.

  3. Tutorial Exercises:

    Complete the Tutorial Exercises listed below.

Program Specifications

Note that you must complete this program either by yourself or by working with one other student of this class following the rules of Pair Programming for Homework Assignments.

  1. Write a graphics application that uses the Turtle class to draw one of the following shapes at a time:
    1. Your initials (and partners if pair programming)
    2. Equilateral triangle
    3. Square
    4. Pentagon
    5. Hexagon
  2. Using your turtle, and NOT cin, ask a user to select which shape to draw by entering the number of sides to display:
    Enter number of sides: 
  3. After entering the number of sides, allow the user to enter the length of the sides using your turtle (and NOT cin):
    Enter length of sides: 

    Note that all shapes, except for your initials, must change size based on the length entered.

  4. The program must draw a single shape with the number of sides and the length of sides that the user entered.
  5. If the user enters 1 for the number of sides, your program must draw at least three initials of your name. There is no need to ask for the length though you may if you like.

    In the example program I draw my three initials. However, you must draw your initials and NOT the instructor's initials. If you do not have three names, then you may use "X" for the extra initial.

  6. You must clear the old shape from the window before before drawing a new shape.

    Use the clear() command of the Turtle class.

  7. After drawing a shape, repeat the program using a while loop and ask the user if they want to run again, using your turtle and NOT cin, with the following message:
    Do you want to run again? (y/n)

    If the user enters a "y" then repeat the program. If the user enters any other value, then exit the program using the statement: exit(0);.

  8. The name of the source code file must be turtleselect.cpp and all your code must be in this file.

    Be careful of the spelling, including capitalization, as you will lose points for a misspelled name.

  9. Remember to include a file comment block and follow all the style rules we have covered so far.
  10. Submit your files to Blackboard as explained in the section of this document: What to Turn In.

Example Program

You can see an example of how the program operates by downloading and running the executable file: turtleselect.exe. Note that this example program may include some of the extra credit.

Extra Credit

The following are worth extra credit points:

  1. Complete the assignment using pair programming. (1 point)
  2. Use a variable declaration with the modifier const to give a name to all numbers in your program except -1, 0, 1, and 2. See the instructions for No Magic Numbers. (1 point)
  3. It is possible to draw shapes with any number of sides by using a loop. Read ahead and use a loop to allow your program to draw any number of sides greater than zero. Do not add any more user input statements to implement this feature. (2 points)

Make certain that your README.txt file describes any extra credit attempted.

Tutorial Exercises

To prepare for the next lesson, complete the following exercises.

  1. Type the following programs from the textbook on pages 134 and 135 into a text editor, and then compile and run the programs. When they are working, submit them to Blackboard for grading. Make certain you use the same file name as the program name.
    1. sentinel.cpp
    2. maxtemp.cpp
  2. Type the program futval.cpp from the textbook on page 157 into a text editor, and then compile and run the program. Submit your working source code file to Blackboard for grading using the file name futval.cpp.
  3. Complete the Tutorial Exercises in CodeLab 4 before the specified due date. Refer to the assigned reading for the next lesson to help you understand the problems. Also, you can use the online lecture notes for more information as the notes become available.

Grading Criteria

The instructor will evaluate your assignment using the following criteria. Each criteria represents a specific achievement of your assignment and has a scoring guide. The scoring guide explains the possible scores you can receive.

Some scoring guides have a list of indicators. These indicators are a sign of meeting, or a symptom of not meeting, the specific criterion. Note that a single indicator may not always be reliable or appropriate in a given context. However, as a group, they show the condition of meeting the criterion.

For information on grading policies, including interpretation of scores, see the course information page.

Lesson Exercises

  • 2: All lesson exercises attempted and turned in
  • 1: Some lesson exercises completed and turned in
  • 0: No lesson exercises completed or turned in

Program Compilation

  • 4: Source code compiles with no errors or warnings
  • 3: Source code compiles with 1 warning
  • 2: Source code compiles with 2 warnings
  • 1: Source code compiles with 3+ warnings
  • 0: Does not compile or wrong file turned in

Program Functionality

  • 10: Demonstrates mastery of the assignment
    • Applies concepts from the lessons appropriately
    • Meets all specifications (see above) with particularly elegant solutions
    • Runs to completion with no abnormal error conditions
    • Generates correct output given correct input
    • Behaves in a reasonable way in response to incorrect data
  • 8: Has all the functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • Attempts to meet all specifications (see above)
    • Implementation seems more complicated than necessary.
    • May have one minor error
  • 6: Has most of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Attempts to meet all but one of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have 2-3 minor errors
  • 4: Has some of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Attempts to meet at least 1/2 of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have more than 3 minor errors
  • 2: Serious functional problems but shows some effort and understanding
    • Attempts to meet less than 1/2 of the of the specifications (see above)
    • Has a major error or many minor errors
    • Implementation seems very convoluted
    • Demonstrates few techniques from the lesson
  • 0: Does not execute

Program Style

  • 4: Code is well-documented including:
    • Name, date, and program description in file comment block
    • Follows specified format for file comment block
    • Proper use of spaces around operators
    • No tab characters are present in the source code
    • As described in How To Document and Organize C++ Code
    • Correct file name used
  • 3: Code has a minor documentation error
  • 2: Code has some documentation errors
  • 1: Code has many documentation errors
  • 0: No apparent attempt to write documentation comments

CodeLab and Other Tutorial Exercises

  • Number CodeLab completed correctly / number exercises * 8 and rounded up to the nearest integer.
  • -1 if any tutorial exercise file does not compile
  • -2 if any tutorial exercise file is not turned in

README.txt File

  • 2: README.txt file submitted following the instructions
  • 1: README.txt file submitted but some information was missing
  • 0: No README.txt file submitted

Total possible: 30, plus extra credit

What to Turn In

Submit your assignment to Blackboard, in the assignment folder that matches the name of this assignment, following the instructions for submitting homework. Include the following items for grading:

  1. README.txt file
  2. All the exercise files from Lesson 4
  3. turtleselect.cpp
  4. All the tutorial exercise source code files

You must submit all the files needed to complete your assignment. Your assignment must work as submitted.

You may assume that I have the turtle and graphics classes we discussed in class and you do not need to turn in the source code for those classes.

Home | Blackboard | Announcements | Day Schedule | Eve Schedule
Course info | Help | FAQ's | HowTo's | Links
Last Updated: March 22 2009 @14:39:11