CSSE 120 -- Intro. to Software Development

Homework 6

  1. Read Zelle Sections  4.6-4.7
  2. (15 points) Complete the ANGEL quiz over this reading. You'll find this on the course ANGEL page, under Lessons → Homework → Homework 6 → FilesAndFunctions
  3. (26 points) In-class pair-programming exercises (once again, the stronger programmer should navigate while the pother person drives).
    1. In Eclipse (PyDev perspective), make a new PyDev project called Session6.
    2. In that project, create a new PyDev module called Session6. (right-click the src folder and choose New...).
    3. In ANGEL, go to Lessons → ModulesToDownloadInClass → Sessoin6.py . 
      Copy the code form that file and paste it into the Session6.py document that you created in Eclipse. 
      Do all of your work for the in-class exercises in this file.
    4. Add the names of both partners in a comment at the beginning of the file.
    5.  You will do several short programming exercises from your textbook.  The instructions are in comments in the code.  And there is a TODO in each place where you should do something or write some code.  
    6. When you have finished all parts, run your program one last time, to be sure that everything works.
    7. One partner: submit your Session6.py file to the Session6 Drop Box in the Homework 6 folder on ANGEL.
    8. Also email the file to your partner, so both of you will have a copy.
    9. If you do not finish the exercises during class, finish them before the next class session.  Plan when you and your partner can get together.
    10. If you finish these exercises early, go on to the homework problem, which you will also do as a pair.
  4. (20 points) Homework pair-programming problem.  Write your code as a pair, with the same person with whom you worked in class.  The code is short, but there are a couple of challenging aspects.  We suggest that you begin today so that if you get stuck there is a chance to ask for help.  Before you leave class today, plan when you and your partner will meet to work on this problem.
    1. You will do Exercises 4.8 and 4.9 from Zelle, page 119.  You may assume that the input string consists only lower-case letters.
    2. In Eclipse (PyDev perspective), use the same Session6 project that you created for the in-class exercise.
    3. In that project, create a new Pydev module called Caesar.  Do your work for this problem in this file.
    4. Do exercise 4.9 (read 4.8 first).        For simplicity, assume that each message consists only of lower-case letters.
      You can just do message decoding. 
      • Ask the user for an offset (the number of characters the message was shifted when it was encoded)
      • Then ask for the coded message.
      • Print the decoded message.
    5. Example messages to try (decoded message should be readable):  shift: 22 code: nkoadqhiwj    shift: 10 code: exnopokdonmyvdc
    6. Wraparound help:  One approach to doing wraparound is to use Python's if statements.  If you wish, you can read ahead to chapter 7 and use if.  But a better (for learning) approach is to use the % operator  when you calculate how far the decoded character should offset from 'a'.  Hint:  The number after your % operator should probably be 26. Another hint:  What is the value of chr(ord('a') + (ord('k') - ord('a') - 2)) ?  
    7. One partner: Submit your Caesar.py file to the CaesarCipher Drop Box in the Homework 6 folder on ANGEL.
    8. Also email the file to your partner, so both of you will have a copy.