CSSE 120 — Introduction to Software Development, Robotics

Homework 4

Reminder: for each class session and associated homework:

  • You generally have reading to do.
  • 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 Pydev 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.
    It is a GOOD idea to COMMIT OFTEN, not just when you finish the homework. Doing so provides easy backups of your work.

Questions? Email csse120-staff@rose-hulman.edu.

Best place and time to do the homework: CSSE lab (Moench Hall, room F-217), 7 p.m. to 9 p.m., Sunday — Thursday.

Today's project: Session04_NumbersAndLoops

Main learning objectives for this homework:

  • Continuing to understand functions with parameters and calling such functions with actual arguments
  • Continuing to understand functions that return values and how to use those returned values, often by capturing the returned value in a variable
  • Objects:
    • Constructing
    • Using : dot notation for methods and instance variables (aka fields )
  • The Zellegraphics module for simple graphics
  • Introduction to the debugger in Eclipse.
    • Using it to inspect values of variables.
  • Counted loops , i.e., loops that use a range statement
  • Accumulator loops : accumulating a sum, product or string

Additional learning objectives for this homework:

  • Continuing to get familiar with Eclipse (your IDE — Integrated Development Environment)
  • Continuing to explore defining functions versus calling functions
  • Continuing to explore printing versus returning a value

Do the following exercises. For problems 2 and following, use today's project: Session04_NumbersAndLoops

  1. Complete the assigned reading for the next session, Zelle, Chapter 4.
    • Much of Chapter 4 has details that you should just skim, returning to the text for reference when you need those details.
    • For example, all of Section 4.8 is in this category — just skim that section briefly and return to it as needed for reference.
  2. Briefly review the code in the first three modules, all in the P1_Review folder of today's project.
    • If you have questions about any of that review code, bring those questions to class.
    • Nothing to do for those modules (and this problem), just review the code to see if you have questions.
  3. Do the TODO's in the m4_distance_between_clicks.py module of today's project, if you did not complete them in class.
  4. Do the TODO's in the m5_counted_loops.py module of today's project, if you did not complete them in class.
  5. Do the TODO's in the m6_accumulator_loops.py module of today's project, if you did not complete them in class.
  6. Do the TODO's in the m7_loops_practice.py module of today's project.