CSSE 120 — Intro. to Software Development

Homework 2

  1. Complete the assigned reading for the next session, Zelle, § 2.5 - 2.8.
  2. (29 pts) Complete the ANGEL quiz over the reading for the next session. You'll find this on the CSSE 120 ANGEL page, under Lessons → Homework → Homework 2 → Writing Simple Programs

    Note: the due date of all parts of homework, except reading quizzes assigned on a Thursday of any week will automatically be extended to the following Monday, unless otherwise noted. The workload in this course is high, and we want you to have at least 48 hours to complete every assignment. Reading quizzes (on ANGEL) are due at the start of next class.  We recommend that you try to complete the programs assigned on Thursday before the next class meeting, but we do not require you to do so.

    Day assigned Reading quizzes due Other parts of assignments due
    Monday Tuesday Wednesday
    Tuesday Thursday Thursday
    Thursday Monday Monday

    Note that the due time for all quizzes, programs, and other homework is the same time of day as the beginning of your class meetings.

  3. Web links, bacon, eggs, and spam: The Python programming language was named after the English comedy team Monty Python. The Python community on-line is fond of making "in-joke" reference to various Monty Python sketches. One of today's in class examples was a reference to the legendary Dead Parrot Sketch. Watch the five minutes 33 seconds video and start to become a member of the Python community!

Do the remaining problems in the 02-InputComputeOutput project that you checked out in class from your SVN repository.

The URL for your repository (that you need to enter into the Add Repository dialog box in Eclipse) is:

http://svn.csse.rose-hulman.edu/repos/csse120-201210-username

where username is your Rose-Hulman username (like loaj).

Create new files with the names given in each problem description. Commit your solutions to each problem to your SVN repository, after completing the problem. I encourage you to commit often.

When writing your new programs, follow the style that we modeled in the 02-InputComputeOutput project:

def blah():
    '''A short description of the blah function goes here'''
    BODY of blah goes here

def main():
    '''Invokes the blah function.'''
    blah()
    
if __name__ == '__main__':
    main()
  1. (5 pts) Complete Programming Exercise 1.3 on page 24 of Zelle.
    1. Write your one paragraph essay in a text file named homework2.txt. You do not have to include the code that you wrote, just your paragraph. Follow this link for instructions on adding the file to your project.
    2. Commit your solutions to your SVN repository.
  2. (5 pts) Complete Programming Exercise 1.5 on page 24 of Zelle, in a file called chaosTable.py
    1. Enter all your code in the chaosTable.py module.  Run it to make sure it works as expected.
    2. Commit your solutions to your SVN repository.
  3. (10 pts) Implement a Python program that calculates the distance between two points. Name your program pythagoras.py. Run your program to make sure that it works as expected.  Test it with several different pairs of points. Your program should:
    1. Prompt the user to enter the x and y coordinates of two points.
    2. Use the math module as part of your code to calculate the distance between the points. (If you don't remember how to import the math library, see the transcript from Session 1.) You'll find the sqrt function helpful.
    3. Display the distance between the points, with a descriptive label.
    4. Commit your solutions to your SVN repository.
  4. Optional Bonus Problem (5 pts) During a previous offering of this course, a small group of students requested that we add some more challenging problems.
    1. If you found the other ones really easy, you may want to try Programming Exercise 1.7 on page 25 of Zelle -- completing it correctly will earn you a small number of bonus points. We realize that the homework in this class is sometimes long, thus this is optional. Name your program chaosTableBonus.py.
    2. Commit your solutions to your SVN repository.