CMSC 201

# Lecture Exercises

One group is chosen as the winner for each lecture exercise. Since many groups can have correct answers, other criteria are also used for picking the winning group. These include use of meaningful variable names, meaningful prompts and output, use of whitespace and adherance to 201 coding standards. Even handwriting can be used to break a tie.

Each member of a winning group will receive 1 point of extra credit on the next exam.

If there is a tie between a group that has won previously and one that has not, the new group will be declared the winner.

### Extra Credit Winners

Lecture Students Winning Code
Class Exercise
Lec 08
5/11/10
Will Gossard
Josh Mayne
SQUARE = 2
CUBE_SIDES = 6
CUBE = 3

class Cube:
def __init__(self, length):
self.length = length

# Accessors
def getLength(self):
return self.length

def surfaceArea(self):
area = CUBE_SIDES * self.length ** SQUARE
return area

def volume(self):
vol = self.length ** CUBE
return vol

Class Exercise
Lec 01
5/10/10
David Ring
Kameron Pyron
# Exercise: Defining New Classes
# File: cube.py
# Names: David Ring & Kameron Pyron
# Date: 5/10/10
# Description: This class defines a cube object using
# the length of a side as its sole parameter.
# It has methods to access side and return
# volume and surface area.

class Cube:
def __init__(self, side):
self.side = side

def getSide(self):
return self.side

def volume(self):
return self.side ** 3

def surfaceArea(self):
return 6 * self.side ** 2

Monday, 17-May-2010 09:13:27 EDT
 Adapted from UMBC CSHC's webpage designed by Dan Hood