Object Oriented Design - Writing Classes

In class exercises
Change into your inclass directory.
[~]$ cd
[~]$ cd cs21/inclass/
If the w11-oop directory does not yet exist, create it using mkdir
[inclass]$ mkdir w11-oop
Copy the sample files for today from my directory using cp
[inclass]$ cp ~adanner/public/cs21/w11-oop/* w11-oop/
[inclass]$ ls
w02-numsAndStrings/  w04-graphics/   w07-design/     w11-oop/
w01-intro/      w02-strings/         w05-functions/  w08-search/
w01-solutions/  w03-decisions/       w06-loops/      w09-recursion/
[inclass]$ cd w11-oop/
[w11-oop]$ ls
card.py deck.py digitalclock.py
[w11-oop]$ 
This week we are going to do some of the following as an intro to Object Oriented design.
A Card class
We will use this code as a starting point for discussing classes and how to write your own classes.

open card.py and add a isFaceCard method that returns True if a card is a face card (Jack, Queen, or King). Otherwise, the method should return False.

A Deck class

Open deck.py and complete the constructor that creates a deck of cards as a list of 52 Card objects of the appropriate rank and suit.

Complete and test some of the other methods listed at the end of the class: (dealOne, deal, cardsLeft, shuffleIn).

A digital clock

implement the rest of the classes in the digitalclock.py file to create a digital clock that will be drawn to the graphics window. It will look something like this when the time is 12:59:13

Clock displaying 12:59:13