Programming Assignment #1: Python



Programming Assignment #1: Python

Due Date: Tuesday, September 20

NOTE: There will be a total of 4 programming assignments provided during the semester. Undergraduate students will be expected to complete 3 of the 4 assignments, graduate students are expected to complete all 4. For undergraduates, you may choose which of the 4 you will skip. To help you determine this, the four assignments will cover the following languages:

Assignment 1: Python

Assignment 2: Lisp (Common Lisp recommended)

Assignment 3: an Olde language (FORTRAN, COBOL, ALGOL, PL/I)

Assignment 4: a Pascal/Ada-like language (Pascal, Ada, Delphi, Modula-2, etc)

If you have already had experience with one of the languages, you will be required to work on the other three assignments. If you have already had experience with Pascal, Ada, Delphi or Modula-2, you may still do assignment 4 as long as you select a different language. See me if you have had experience with more than 1 of the above languages.

The Python Assignment:

You are to download Python for your computer and install it along with the development environment (its free! You can find a link to the Python site from my 407/507 handouts page). Learn enough of the language to implement a small Object-oriented program. Your program should include at least 2 classes, each of which should have a constructor method and at least 2-3 other methods. Your program should have a main method which creates objects and passes the objects messages. In all, your program should have a minimum of 6 methods. See the example on the instructor’s website dealing with shapes for a simple example.

Some example applications might include:

1. Game – create a Dice oriented game by having a Die class, a Board class, and Player classes and have them move around the board.

2. Game 2 – alternatively, create a D&D type game having a Die class and Creature classes that fight each other.

3. Prefix/Postfix evaluator – create the proper ADTs that you will need (stack, queue) to input a prefix or postfix expression and evaluate it, or more challenging, an infix expression that has parentheses, which is then converted to prefix (or postfix) and evaluated.

4. Hashing – implement a hash table and function and store a group of tuples in the hash table including a collision processing strategy (note: students who have not had 364 may not want to try this one!)

5. Container classes – for a more advanced type of assignment, implement your own container type(s) in Python and then use them. One interesting aspect of Python storage is that containers do not have to be homogenous, for instance, an array can store different types of items. Create a class that promotes this concept and then use it to store different kinds of information – for instance, store students, grad students, and faculty in a list where each entry has different types of information.

6. Other – select your own application as long as it fits the above requirements (2 or more classes, with a combined minimum of 6 methods, and a main that creates objects). To make sure the application is worth implementing, you should run it by your instructor first before starting.

Hand in your commented code (hard-copy only), 3 or so example runs of your program’s output, and a 1 page report describing your program, what it does, what you learned in implementing it, how your implementation would differ from a C++ or Java implementation, and any conclusions you can draw regarding Python as a language (readability, writability, ease of use, cost in learning it, etc).

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download