Week 8: Exercises

1. Drawing Squares

Write a GTK or Windows Forms application that lets the user draw squares by dragging the mouse. Each square should have a random color. If the user clicks on an existing square, they can drag it to a new position, and it should rise to the top of the Z-order.

2. Bouncing Ball

Write an application that displays a bouncing ball. The ball should lose a bit of velocity each time it hits the ground, so that it eventually comes to a stop.

3. Bouncing Balls

Extend the previous application so that the user can create new balls by clicking the mouse. Each ball should have a random size and color. All the balls should bounce simultaneously.