CMU 15-190 Spring 2017: Topics in Intermediate Programming
Homework 2 (Due Wednesday 1-Feb, at 11:59pm)



  1. Understand and comment the code
    Working together as a group, discuss the code we wrote. It's just 149 lines, including all the comments and the test code (such as we wrote any test code). Be sure to understand what each function is doing and how it is doing it. Then, make minor improvements. In particular, add some brief but clear comments at the top of each function explaining what that function is doing and how it is doing it. Don't go overboard here, just enough comments to show that you clearly understand the code. Include this commented code in your PDF file you submit.

  2. Better variable names
    In several cases, we had trouble finding good variable names. Find at least two such cases. List the line numbers on which they occur, include the code as we wrote it, describe why we may have had a problem coming up with a good variable name in that case, and then suggest another perhaps better alternative approach than the one we took in lecture. Your two examples should be distinctive, so not just two cases of the same issue.

  3. Manually solve for the sum-of-squares
    This is not a programming problem. Working without a computer or calculator, following our algorithm closely, compute the solution to find the coefficients of the polynomial solution to 12 + 22 + ... + n2. You may format this how you wish, including writing it by hand and scanning that into your PDF file. Note that there are numerous ways to solve this, but you have to closely follow the algorithm we used in lecture, and the one that is used by our code. Include the intermediate results as you go, and not just the final answer.

  4. What to Submit
    Each member of the group should submit their own PDF file, 15-190-hw2.pdf, containing this information:
    1. Your name and andrew id
    2. The names and andrew id's of your groupmates
    3. The start/stop times you worked, and the total time you worked.
    4. Your thoughts about this exercise -- useful, interesting, etc? This will help us improve the 15-190 experience as we go.
    5. The solutions from above. Note: one way to create a PDF is to first make a Word file, then export that to PDF.
    You can submit your hw to the 15-190 autolab site here.

Have fun!