CSSE 120 -- Intro. to Software Development

Homework 6

Reminder: for each class session and associated homework:
  • You do the Reading Quiz on Angel.
  • You do all other work in Eclipse in the project that you checked out for that session.
  • You turn in your Eclipse work by committing that project:
    • Right-click on the project name in the Package Explorer view.
    • Select Team ~ Commit
    • In the message box that appears, put a message to yourself if you wish (eventually, these messages will be for your teammates) and press OK.

  1. There is no reading quiz today.  Do all your work in the project you checked out in class today:  06-StringsAndLists.
  2. (15 pts) Decoding messages: Suppose you are a security agent who encrypts messages that you send to other agents.  Of course, the receiving agents need to be able to decode the encoded messages they receive from you.  Assuming that both you and the agents receiving your messages share a common key that you use to encode and decode messages, write and test the decode function in the 3-encodeDecode.py module that uses a common key to encode and decode messages.  Your decode function should be able to:
    1. Prompt the user for a list of integer codes (for an encoded message)
    2. Prompt the user for a secret key (same key used for encoding)
    3. Reverse the calculation of the encode function.  Note:  You may wish to consider using String's join method.  In the PyDev console type help(string.join) at the prompt after importing the string module.
    4. display the decoded message to the console.

    Submit your Python source file by committing your changes to your SVN repository.

  3. (20 pts) Loops and string formatting: Storing information in files is a very important exercise for engineers running experiments that generate a large quantity of useful data.  The stored data can later be analyzed, categorized, and manipulated to allow engineers to draw useful conclusions.  For now, you will write the data to the screen; in a later exercise, you will actually write it to a file.

    Often, the generated data is formatted so that another program can automate the process of analyzing, categorizing, and manipulating the data. In this problem you are to write and test a function functionDisplay in module, 4-funcDisplay.py, that implements the following design:

    Submit your Python source file by committing your changes to your SVN repository.

  4. (15 pts) Approximation of pi:  Solve programming exercise 15 on page 78 of your text in module 5-approximatePi.py.  Submit your Python source file by committing your changes to your SVN repository.
  5. (10 pts) Challenge Problem: This problem is not required, but is an interesting extension that you might like to try.
    1. Write and test a version of the functionDisplay function, called enhancedFunctionDisplay() that prompts the user to enter the function for column 2 instead of hard-coding the function, as is done in functionDisplay.
    2. Submit your Python source file by committing your changes to your SVN repository.
  6. Web links, bacon, eggs, and spam: One of today's in-class examples was a reference to the Penguin sketch. We hope you enjoy this four minute cultural experience!