CSC 216 F09/Interfaces: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
Next, the instructor will tell the students that there is a class called Pirate, which will implement interface.  That means that Pirate must also have a head, body, mouth, and eyes.  However we want Pirate to be able to do more than just what Person could.  So, we will also require other important characteristics, such as arms, legs, pirate hat, and parrot.  The students will then be asked to create their own Pirate, while making sure to implement Person in their drawing.
Next, the instructor will tell the students that there is a class called Pirate, which will implement interface.  That means that Pirate must also have a head, body, mouth, and eyes.  However we want Pirate to be able to do more than just what Person could.  So, we will also require other important characteristics, such as arms, legs, pirate hat, and parrot.  The students will then be asked to create their own Pirate, while making sure to implement Person in their drawing.


http://www.metacafe.com/watch/3751899/learning_project_for_csc226_implementation_in_java/
[[Image:Csc226vid_pirate.avi.GIF]]

Revision as of 19:03, 17 November 2009

Pirate Implements Person

Purpose of this Exercise

Through this exercise, students can come to a better understanding of interfaces and their implementation. This is a simple exercise that makes a concept that can sometimes be confusing, relatively simple.

Requirements for the Game

This game is to be played by a group of 4 or 5 students. The instructor will only need a white board or a chalk board, so that the students can draw for the entire class to see.

How the Game is Played

The instructor will give them instructions of how to create a person. In other words they will give requirements necessary for a stick figure of a person, such as a head, body, mouth, and eyes. each student will draw this person, and they should all be the same. This first step represents the interface Person.

Next, the instructor will tell the students that there is a class called Pirate, which will implement interface. That means that Pirate must also have a head, body, mouth, and eyes. However we want Pirate to be able to do more than just what Person could. So, we will also require other important characteristics, such as arms, legs, pirate hat, and parrot. The students will then be asked to create their own Pirate, while making sure to implement Person in their drawing.