About the Programming Assignments Archive

This archive provides an open forum for computer programming instructors to share and discuss their favorite programming assignments. Of particular interest are nifty, fun, motivating, and inspiring assignments to introduce and draw new students (both majors and non-majors) into the world of computing. Read the FAQ for more information.

You can browse programming assignments by clicking on Forums, selecting Tags, searching by keyword, or subscribing to the RSS feed.

Please post feedback and suggestions for improving the site on the feedback thread.

"I Spy" or "Where's Waldo" Graphical Quiz Game

Submitted by Kenrick on Sat, 03/08/2008 - 23:10.
Mar 9 2008 - 12:10am
Etc/GMT-8
computerIdentify.png

In this assignment the program displays an image of the student's choice. The user then has to click on the image to find three items. I like to use this after we've covered if-then-else statements and the difference between local variables and class variables. In class I give students a template for how to display an image and get the location of a mouse click so they can complete the assignment earlier in the semester.

The fun part is students select some interesting items for their quiz. I've gotten quizzes to identify parts of a cricket, a human skull, areas of a star, species of fish, and many more.

Assignment: Graphical Quiz

Monty Hall Game Show Problem

Submitted by Kenrick on Thu, 10/25/2007 - 22:49.
Oct 25 2007 - 10:49pm
Etc/GMT-8

This problem is to simulate the Monty Hall Problem, which was popularized by Marilyn vos Savant in her Parade column. The problem is stated as:

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

Sierpinski Gasket

Submitted by Kenrick on Thu, 10/25/2007 - 22:28.
Oct 25 2007 - 10:28pm
Etc/GMT-8

A Sierpinski Gasket (or Triangle) is a type of fractal named after the Polish mathematician Waclaw Sierpinski who described some of its interesting properties in 1916. It is a nice example of how an orderly structure can be created as a result of random, chaotic behavior. In fact, the gasket can only be created by random behavior. http://serendip.brynmawr.edu/playground/sierpinski.html is a good site to learn more about Sierpinski Gaskets.

Mozart Dice

Submitted by Kenrick on Thu, 10/25/2007 - 21:18.
Oct 25 2007 - 9:18pm
Etc/GMT-8

This is a simplified version of the