Docsity

Homework 3 for Introduction to Computing | CS 1301, Assignments of Computer Science

Toggle sidebar
bg1
CS 1301 – Spring 2009
Homework 3 – Getting to know your robot
Due: Wednesday, Jan 28th at 6 PM
Out of 100 points
Files to submit: 1. hw3.py
For Help:
- TA Helpdesk – Schedule posted on class website.
- Email TAs
Notes:
•Don’t forget to include the required comments and collaboration
statement (as outlined on the course syllabus).
•Do not wait until the last minute to do this assignment in case you run into
problems.
•If you find a significant error in the homework assignment, please let a TA know
immediately.
Part 1 – Dance, robot, dance! (55 points)
Hopefully by now, you’ve gotten your robot out of the box and made friends with it (or at
least acquaintances); given it a name and a back story. Well, how about now you take it
out to a dance?
Of course, you’ll have to teach your robot to dance. Using the movement functions:
http://wiki.roboteducation.org/Myro_Reference_Manual#Movement_Functions
have your robot do a little dance. The dance should last for at least seconds, and contain
at least 3 distinct dance moves, ie don’t just go back and forth for 30 seconds; vary the
dance a bit. Pretend you’ve got a spastic robot. In addition to the movement, your robot
should also make some noise! The beep() function is very helpful – it allows the robot
produce various tones. You are allowed (and encouraged) to make your own helper
functions that contain individual dance moves.
Write your dance as a function called dance(), and save it into a file called hw3.py. As
always, please name your file exactly as requested.
Part 2 - Conversions (45 Pts Total, 15 for each subpart)
Section A – Area (15 pts)
pf3

Partial preview of the text

Download Homework 3 for Introduction to Computing | CS 1301 and more Assignments Computer Science in PDF only on Docsity!

CS 1301 – Spring 2009

Homework 3 – Getting to know your robot

Due: Wednesday, Jan 28th^ at 6 PM

Out of 100 points

Files to submit: 1. hw3.py For Help:

  • TA Helpdesk – Schedule posted on class website.
  • Email TAs Notes:
  • Don’t forget to include the required comments and collaboration statement (as outlined on the course syllabus).
  • Do not wait until the last minute to do this assignment in case you run into problems.
  • If you find a significant error in the homework assignment, please let a TA know immediately.

Part 1 – Dance, robot, dance! (55 points)

Hopefully by now, you’ve gotten your robot out of the box and made friends with it (or at least acquaintances); given it a name and a back story. Well, how about now you take it out to a dance? Of course, you’ll have to teach your robot to dance. Using the movement functions: http://wiki.roboteducation.org/Myro_Reference_Manual#Movement_Functions have your robot do a little dance. The dance should last for at least seconds, and contain at least 3 distinct dance moves, ie don’t just go back and forth for 30 seconds; vary the dance a bit. Pretend you’ve got a spastic robot. In addition to the movement, your robot should also make some noise! The beep() function is very helpful – it allows the robot produce various tones. You are allowed (and encouraged) to make your own helper functions that contain individual dance moves. Write your dance as a function called dance() , and save it into a file called hw3.py. As always, please name your file exactly as requested.

Part 2 - Conversions (45 Pts Total, 15 for each subpart)

Section A – Area (15 pts)

For the next 3 parts, you will be writing small functions that convert between the Standard (US) and Metric measuring systems. For part A, you will write a function called area() which takes in a value in US Standard square inches and coverts that value into the Metric square centimeters. For reference, there are 6.45 square centimeters in one square inch. Please return the value. Save this function in your hw3.py file as well. Sample Output:

area(2)

area(5)

Section B – Volume (15 pts)

In this section, you will need to convert volumes. There are 2.11 US pints in one liter. Write a function called volume() that takes in a value in liters and converts it to US pints. Since we want to know what we’re dealing with, print the value out with a nice little sentence explaining the conversion that just happened. Please print the values to 2 decimal places. See the sample output below. Save this function in your hw3.py file as well. Sample Output:

volume(1) There are 2.11 US pints in 1.00 liters volume(4) There are 8.44 US pints in 4.00 liters

Section C – Monkeys (15 pts)

Just like the previous two problems, it’s conversion time. One average spider monkey is equal to 37.62533333333 hockey pucks. Seriously. Write a function called monkeys() that takes in a number of monkeys and prints out the resultant conversion into hockey pucks. Please round the number of hockey pucks to 4 decimal places. See the sample output for more clarification. Save this function in your hw3.py file as well. Sample Output:

monkeys(3) There are 112.8760 hockey pucks in 3.000000 average spider monkeys monkeys(11.57) There are 435.3251 hockey pucks in 11.570000 average spider monkeys Source for the conversion factor: http://www.weirdconverter.com/ You should totally go there and play around with conversions that don’t make any sense. Impress your professors! Entertain your friends! Dazzle your family!