Assignment 9

Assignment 9 - CS 116 Fall 2009 Assignment 9 Due at 3:30 PM...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 116 Fall 2009 Assignment 9 Due at 3:30 PM on Thursday, December 3 For all assignments, you are expected to use the design recipe when writing functions from scratch. The solutions you submit must be entirely your own work. Do not look up either full or partial solutions on the Internet or in printed sources. Please read the course Web page for more information on assignment policies and how to organize and submit your work. Be sure to download the interface file from the course Web page and to follow all the instruc- tions listed in the Python style guide (on the Web page). Specifically, your solutions should be placed in files a9qY . py , where Y is a value from 1 to 4. This homework largely tests your understanding of the material in the second half of CS 116 Lecture Module 8, and in all of Module 9. A note on online submission: if there is a problem at the deadline for the assignment, please check ˜ cs116 , which should be available even if Odyssey is not working. Further information may be available there. Language level: Any Python version in the range 2.5.0 to 2.6.2. On the student.cs machines, type /opt/csw/bin/python to access version 2.6.2 (just typing python brings up version 2.4.2, which you should not be using). 1. Recall a meeting_time structure has been introduced in Assignment 1. We now represent this structure by using a Python class: the class has three fields. The first field, month , is a string from the set that contains ”Jan” , ”Feb” , ”Mar” , ”Apr” , ”May” , ”Jun” , ”Jul” , ”Aug” , ”Sep” , ”Oct” , ”Nov” , ”Dec” . The second field, day , is a string representing numbers in the range [0: days ] , where days is the number of days in the corresponding month . The third field, hr , is an integer in the range [8:20] corresponding to the starting hour for a meeting (earliest time is 8am, latest time is 8pm which is specified as hour 20). The Python definition for a meeting_time class is: class meeting_time : ’ Fields: month, day, hr ’ (a) Write a function afternoon that consumes a list of meeting_time s and produces a list of meeting_time s that occur in the afternoon ( 12 <= h <= 17 ). (b) Write a function create_meetings that consumes a dictionary representing an event, and a list of meeting_time s. In the dictionary, the name of the event is the key, and the date of the event is the value. The value of the dictionary should match the date in the list of meeting_time s. For example, an orientation event dictionary can be { ”cs” : ”Sep 2”...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 116 taught by Professor T.vasiga during the Fall '09 term at Waterloo.

Page1 / 6

Assignment 9 - CS 116 Fall 2009 Assignment 9 Due at 3:30 PM...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online