Inheritance and Class Hierarchies

 ('Burst-A-Bubble' Game (XNA) ; 'Burst-A-Bubble' Game   (Console) )

Key Topics That Students Will Learn In This Assignment:
  1. Inheritance
  2. Overriding / Polymorphism
  3. Understanding and Modifying Existing Code
Pre-requisite Knowledge That Students Must Know, Prior To Starting This Assignment:

(What students must know in order to able to complete this assignment)

  • Flow Control: conditional selection (if statements)
  • Flow Control: iteration (loops)
  • Simple/Primitive Variables: int, double (etc)
  • Inheritance
  • Method Overriding
  • (Polymorphism is demonstrated in the provided code)
  • Encapsulation
  • Random number generation
    • Optional (a simple modification to the assignment could remove the necessity of this topic)
  • Console version: Basic Console Input/Output
Summary The students will be provided with a non-trivial 'starter project' for the Burst-A-Bubble game.  In this (console-based) game, the player may throw rocks at bubbles.  The rock is thrown from the origin (0,0), and any bubbles that overlap the rock are destroyed.  The game is played in 'rounds' or 'turns', wherein the computer uses the Console interface to ask the player what the player would like to do (including the option of simply doing nothing for a round), and then the program prints out a list of all the objects (including each object's current location, and velocity)

The student is required to extend this game primarily by creating a new subclass of the Projectile type (which is the base class for Rock) named Firework.  A Firework operates similarly to a Rock, except that after a certain amount of time, it explodes, and is thereafter removed from the game.

The XNA version operates very similarly, with the major difference being that the code provided to the students will present the same idea with a fun, graphically interesting interface.  In the XNA version, sprites (pictures) representing the rocks/Fireworks slide smoothly across the screen, and the player can launch new rocks/Fireworks whenever they want to.  This is in contrast to the round-based Console version, which merely prints out a textual 'status' message about each object.

The assignment requires that the student figure out the logic in non-trivial code base, with minimal explanation/guidance from the instructor.  This is assured by a secondary goal of the assignment, wherein the student must modify the provided code so that the bubbles are placed randomly.

  Instructor F.A.Q.
Pre-Test Post-Test
Lecture Hours Prior To Assignment Due Date: 30-35
ACM Classification (Topics Covered):

(What the students will learn, and demonstrate, by doing this assignment)



Computing Curricula 2001

Computer Science

— Final Report —
(December 15, 2001)

written by

The Joint Task Force on Computing Curricula
IEEE Computer Society
Association for Computing Machinery


PF1. Fundamental programming constructs

  • Basic syntax and semantics of a higher-level language

  • Variables, types, expressions, and assignment

  • Simple I/O

  • Conditional and iterative control structures

  • Functions and parameter passing

  • Structured decomposition

PL6. Object-oriented programming

  • Object-oriented design

  • Encapsulation and information-hiding

  • Separation of behavior and implementation

  • Classes and subclasses

  • Inheritance (overriding, dynamic dispatch)

  • Polymorphism (subtype polymorphism vs. inheritance)

  • Class hierarchies

Technical Requirements:

(What the students will learn, and demonstrate, by doing this assignment)



Computing Curricula 2001

Computer Science

— Final Report —
(December 15, 2001)

written by

The Joint Task Force on Computing Curricula
IEEE Computer Society
Association for Computing Machinery


It is hoped that providing this information may help instructors with the accreditation process, as calling this information out will help clarify how this assignment (and from here, the overall course) meets the learning outcomes for the overall program/department, and institution.

Programming Fundamentals: Fundamental programming constructs


PF1.1 - Analyze and explain the behavior of simple programs involving the fundamental

programming constructs covered by this unit.

(Since the students are given the existing code, but aren't given a detailed explanation for how it works, they will have to demonstrate that they have developed an understanding of the program by extending it)


PF1.2 - Modify and expand short programs that use standard conditional and iterative control structures and functions.

(The primary goal of the assignment is to modify the code that's provided by the instructor)

PF1.3 - Design, implement, test, and debug a program that uses each of the following fundamental programming constructs: basic computation, simple I/O, standard conditional and iterative structures, and the definition of functions.

It will be impossible to complete the assignment without the these items. 


PF1.4 - Choose appropriate conditional and iteration constructs for a given programming task.

It will be impossible to complete the assignment without this. 


PF1.5 - Apply the techniques of structured (functional) decomposition to break a program into smaller pieces.

This is largely provided to the students, in the sense that there isn't a lot of extra functions needed.  However, they do need to be able comprehend the existing structure of the provided code, including the functional decomposition inherent in that design.


Algorithms and Complexity: Algorithmic strategies


PL6.2 - Design, implement, test, and debug simple programs in an object-oriented

programming language.

This assignment requires the students to understand and utilize encapsulation, inheritance, and polymorphism.

PL6.3 - Describe how the class mechanism supports encapsulation and information hiding.

The students are not directly asked to describe this, but they are required to mark their data fields / methods with the appropriate access restriction.

PL6.4 - Design, implement, and test the implementation of “is-a” relationships among objects using a class hierarchy and inheritance.

This is one of the primary lessons of the assignment - the new Firework class IS-A Projectile.


PL6.5 - Compare and contrast the notions of overloading and overriding methods in an

object-oriented language.

This assignment helps make the 'overriding' part clear, but does not deal with the 'overloading' part


This document and the related materials are developed with support from Microsoft Research Computer Gaming Initiative under the Computer Gaming Curriculum in Computer Science RFP, Award Number 15871.