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
  3. (10 pts) Complete Programming Exercise 1.3 on page 23 of Zelle. Write your 1 paragraph essay in a text file named homework2.txt. You do not have to include the code that you wrote, just your paragraph.
  4. (10 pts) Complete Programming Exercise 1.5 on page 23 of Zelle. Then choose a number between 5 and 8, and run your program, telling it to print that many numbers. Then copy and paste the entire output of your program into the homework2.txt you created for the previous problem. You do not have to include the code that you wrote, just its output.
  5. (20 pts) Implement a Python program that calculates the distance between two points. Name your program pythagoras.py. Your program should:

    1. Prompt the user to enter the x and y coordinates for two points.
    2. Use the math module's sqrt function to calculate the distance between the points.
    3. Display the distance between the points, with a descriptive label.
  6. Optional Bonus Problem (10 pts) Complete Programming Exercise 1.6 on page 23 of Zelle. Name your program chaosTable.py.
  7. (50 pts) Song 'n' Dance For this project, cause the robot to do some simple actions: first play a distinctive sound as a warning sound. After the sound stops, have your robot do a little dance. It must include angular and linear motion, but stay roughly within a 50 cm radius of its start point. It must also include some sort of repeated motion that you code using a loop. Name your program songAndDance.py.
    1. Don't forget to turn on the robot and bluetooth connection before you start.
    2. Ask the user for the port to which the robot is connected.
    3. Use the time.sleep(...) command as needed.
    4. Even if you aren't artistic, you can still create interesting, distinctive sounds and dances using loops!
    5. If you forgot any of the commands we did in class, refer back to the PyCreate handout I gave you in class
    6. Note: The robot's maximum angular velocity speed is 60 degrees/sec.
    7. Include both partners' names as authors in a comment at the top of your songAndDance.py file.
  8. 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 three minutes 24 seconds video and start to become a member of the Python community!
How to turn in your work:
  • Find the drop boxes on the course ANGEL page, under Lessons → Homework → Homework 2
  • Upload your:
    • homework2.txt file to the Drop Box labelled homework2.txt Drop Box (for problems 3 and 4)
    • pythagoras.py program to the Drop Box labelled Pythagorous Drop Box (for problem 5)
    • OPTIONAL (bonus points) chaosTable.py program to the Drop Box labelled ChaosTable Drop Box (for OPTIONAL problem 6)
  • Turn-in instructions for the songAndDance.py file are in the turn-in instructions for the NEXT homework.