Bubble fountain with wandering black hole
Andrew Mertz, Nancy Van Cleave · The Keep (Eastern Illinois University) · 2013
Programming assignments with graphics elements may be used to spark student interest and enthusiasm, especially in early courses. We have created a sequence of CS I labs, built on the ACM Java Library, which culminates in a Bubble Fountain with Wandering Black Hole, where a particle emitter spews colorful bubbles that bounce around the graphics window while a larger black circle, also bouncing around the window, consumes any particles that cross its path. This assignment requires that students extend an oval class (GOval) from the graphics library. The following is the class hierarchy: • circle: an oval that has same width and height, always • smart-circle: a circle that knows where it is relative to the edges of its graphics window (canvas) • moving-circle: a smart-circle with its own displacement that knows how to move inside its window, bouncing against the boundaries • particle: a moving-circle with a built-in lifetime. When the lifetime expires, the object is removed from the canvas.