CS 220 01/Zelle Winter 2021

OOP and Intro Data Structures

Dates and Times

All due date/times are given in Central Time (US). Please make sure you translate appropriately for your locale.

Submitting work

Items listed with due dates are to be turned in on my.wartburg (see link at top of this page). For most assignments you will be uploading one or more files. You will find the assignment listed on our "Coursework" page. Click on the assignment to get to the assignment turn in page.

On the page for the assignment, you will see two buttons: "upload," and "turn in." You may upload multiple files and freely add/delete to the list of files you have uploaded. However, once you click "turn in," your uploads will be frozen, and you will not be able to make further modifications.

If you have uploaded files but have not yet clicked on "turn in," your files will automatically be turned in for you when the assignment is due. For maximum flexibility, I suggest uploading file(s) for an assignment as soon as it is done, but NOT selecting "turn in." That way you have something submitted (which will eventually get turned in automatically), but you still have the ability to go in and make updates right up until the time that the assignment is due.

Acceptable File Types

Homework answers should be submitted as PDF files. You can use any word-processor or document creating program of your own choosing, but please create a PDF file for hand in. Another alternative (highly recommended) is to simple write out your homework (neatly!) on paper and then use a scanning application on your phone (e.g. camScanner, Simple Scanner) to collect images of the homework into a PDF file for submission.

For Projects, you should always submit the code (module) files. These are text files containing the Python program code. They should have a ".py" at the end of the name, although your computer may not show you the extension. DO NOT submit output from a Python "Shell" Window. If a file you are submitting contains shell prompts (indicated with ">>>"), then it is the wrong file.

For security reasons, my.wartburg does not allow direct submission of files containing program code. You will have to "zip" your files in order to upload them. You should be able to do this on your computer by right-clicking on the file and selecting some sort of "compress" option. If you need help, see these instructions for Windows 10 and MacOS . The resulting file (the one that you upload) will have a ".zip" extension.

Submitting Late Work/Revisions

Coursework links on my.wartburg will accept work until th end of the term (4/21). Consult the syllabus on how late work is considered.

Announcements and Assignments

IMPORTANT NOTE: First Class Session

This is just a reminder that our first class session on 1/18 is at a special time: 10:45 due to our MLK Day schedule. Also, the first session is via Zoom for everyone. The link for our Zoom session was in an email I sent out last week. You can also find it under Class Zoom Sessions on my.wartburg.

Initial Survey

Please complete this questionnaire before the end of class on 1/18: CS 220 Survey

Read Section 1.1

Read section 1.1 of the textbook. Pay special attention to the issues of programming "in the large."

Python Refresher

Review the Python Quick Reference. This is one of the appendices from the CS 120 book; it covers all of Python that you are expected to know already. You may want to print a copy of this to have handy as you are working on class projects.

repl.it sign up

You should get an account on repl.it for use in class. A free account is fine. Once you have created an account, you might play around with the environment a bit to get a feel for how to use it.

(due 1/27) Craps Simulation

Finish up the Craps program that we started in class today. You can either continue on as a team, or team code from today and do it on your own. Just make sure that you include comments at the top that explain who did what parts of the work.

The assignment description from class is here.

Read Section 1.2

Reminder: Quiz 1 (1/27)

The quiz will cover our syllabus, section 1.1 of the textbook, and the Python review that we have been doing. It will take the first 10 minutes or so of class, so be sure to arrive on time whether in person or by Zoom. The Zoom platoon will be doing the quiz online. Students in the classroom may choose to do it either online or on paper.

Quiz 1

The quiz is here.

(due 1/29, class time) dates.py functions "Test" Generation

Following the model of what we were doing at the end of class on Wednesday. Write out a few example tests (example function call and results) for the last four functions in dates.py. You can either write these out on paper or type them into a text file. Either way, you should have it ready for reference at the start of class.

(due 2/3, 11:55 pm) Elapsed Days Project

Finish writing the functions in dates.py and then write a main program that computes how many days a person has been alive. The program should prompt the user for their birth date and the current date and then print out their age in days.

Quiz 2

The quiz is here.

Finish Reading Chapter 1

(due 2/8, class time) Chapter 1 Review Questions

Do the Chapter 1 Review Homework found here.

Read Sections 2.1--2.4

You can safely omit section 2.2.3. We will be discussing Chapter 2 starting on Wednesday (2/10) after the quiz.

Quiz 3

The quiz is here.

Finish Reading Chapter 2

You should have the Chapter read by class time on Monday.

(due 2/17, 11:55 pm) elapsed_days2.py

Starting with the code that we completed in class (2/12), add a helper function having this specification:

          def _month_lengths(year):
	       """ construct a list of month lengths
	       pre: year is an int
	       post: returns a list, lengths, where lengths[month] is the number of
                     days in that month of year

Then use this helper to modify the existing code with an eye toward using this function wherever it can either help to simplify the code or make it more efficient.

The class code is: dates.py If you download this as a zip file of the repl, be careful not to wipe out your existing main program.

Card ADT Example Posted

I posted the code that we worked on in class Monday (2/15) in our handouts folder. You can find then under handouts/card_files.

Quiz 4

The quiz is here.

(due 2/26) Date Object and Unit Tests

This project is a reorganization of our elapsed days code to make use of a simple Date object. Specifically, the functionality that was provided by the unpack_date, pack_date, is_valid_year, day_number, and elapsed_days functions is now incorporated into a Date class.

Your assignment is to complete the Date class in this file: date_obj.py. You will also hand in a testdate.py file that contains unit tests for all public methods of the Date class. You should strive to provide a "complete" set of automated tests in your testdate.py file. The provided main program can be used for manual testing.

Note: this project has an extended due date because of our scheduled mental health day on 2/24. You will have an overlapping project due the following week (3/1), so I suggest getting an early start on this one.

Finish CollectionFun Lab

You should complete the analysis of methods f3--f5 of the CollectionFun Lab that we started in class on Friday. Bring your results to class Monday for discussion, along with any questions/problems that you ran into.

Start Reading Chapter 3

(due 3/5) bridge.py

Write a program that deals and analyzes Bridge hands. A complete description of the program is here. Starting resources are provided in the handouts/bridge folder.

You will need to modify the deck.py code to implement dealing from a "stacked" deck. The handout folder includes 3 example deck files as well as a test_deck.py to test your implementation of this feature. You will also need to add some new methods to the Hand class. There are some suggested useful functions at the end of the class; feel free to modify these to suit your own design.

The exact form for the final program is up to you, but you must implement all the requested features as described. The example_run.txt file shows how your output might look. Be sure to hand in ALL the Python files that comprise your project. The main program should be in a file called either bridge.py or main.py. At a minimum, you will also need to include your card.py, deck.py, and hand.py files. You can put these all into a single zip archive for submission on my.wartburg.

Reminder: Midterm Exam, Weds 3/3

This will be an in-class paper and pencil exam. Everyone is required to be in-class for the exam. You may use the Python Quick reference (printed on paper) and a calculator on the exam. You will not be allowed to use your computer or cell phone. The exam will cover our Python Review and Chapters 1--3.5, including our programming projects.

To see what sort of questions you might expect on the midterm exam, check out the midterm review.

Study Section 3.6

(due 3/15, 11:55 pm) Cipher Generator

The project description is here.

Quiz 5

The quiz is here.

CD Collection Lab (in-class 3/15)

As usual, select a team "captain" to fork the replit code we are working on here. Then do the following:

  1. Create a new class for CDCollection

  2. Write a constructor that sets first to None

  3. Write an addCD method that takes a MusicCD as a parameter and adds it to the beginning of the collection. Here is an algorithm:

    	     set newCD.link to what first is now
    	     set first to the newCD
  4. Convert the printCDs function into a method inside CDCollection.

  5. Add test code in main() to create a CDCollection, add your cds to the collection and print them out. (Note: they will print in the reverse order that you added them. Do you see why?)

(due 3/24, 11:55pm) CD Collection Homework

Add two features to the CDCollection class:

  1. Add an appendCD method that adds a MusicCD to the end of the collection (so it is that last one printed). To do this efficiently, you should add an instance variable, last, that stores a reference to the last CD in the linked list.

  2. Make the collection iterable. For example, you should be able to print out the information about all of the CDs in mycollectionvia:

    	       for cd in mycollection:

You should also add testing code to main that creates a small collection using appendCD and then loops over the collection to print out the info on all the cds.

Quiz 6

The quiz is here.

Quiz 7

The quiz is here.

(due 3/31, 11:55pm) RPN Calculator

You are to write a program that evaluates expressions in reverse Polish notation. The input to the program is a sequence of postfix expressions using the operators: +, -, *, /, and ^ (for exponentiation). The numbers and operators in the input expressions are separated by spaces. Your program should evaluate each expression and print out the resulting value. If the expression causes an error, the program should print ERROR. The program quits when the user hits <Enter> without typing an expression.

Here is a example of what an example run might look like:

Welcome to the RPN calculator!
>> 34 20 +

>> 3 4 5 * +

>> 5 2 5 ^ *

>> 5 2 5 ^

>> 3 4 + 5 *


Thanks for using the RPN calculator

Finish Reading Chapter 5

You can safely skip the sections marked as optional.

(Due 4/9, 11:55pm) Marble Clock

You are to implement the Generalized Marble Clock.

(Due 4/12, 11:55pm) Chapter 6 Study Guide

The study guide is here.

Quiz 8

The quiz is here.

(Due 4/19, 11:55pm) Chapter 7 Study Guide

The study guide is here.

(due 4/21, midnight) mset.py

Your project is to modify the binary search tree code to implement a multiset ADT, and then use it to write a sorting algorithm. A detailed description, along with the starting code, is in the folder handouts/chapter7.

Reminder: Final Exam

Our final exam is scheduled on Monday 4/26 at 3:00 pm. This will be an in-class written exam convering the material since the mid-term exam (Chapters 4--7).

Quiz 9

The last quiz is here.

Study Aids

I have posted complete solutions to the study guides as well as some example questions for Chapters 4 and 5 in the handouts/final_prep folder.