Computer Science I (20-CS-121) Summer 2007

Class: MWF 12:30 - 2:20pm in Baldwin 649 Lab: MW 2:30 - 6:20pm in Baldwin 550
Syllabus: pdf        Schedule: pdf

Class Links: Class Notes Assignments Lab Assignments Course Updates Grading of Course

Teacher: Ryan Flannery
Office: 805b Rhodes Office Hours: TH 12:30 - 2:30pm And by appointment!
Phone: (859) 750-3088 Course Website:

Class Notes

  1. Administrative stuff, brief history of CS, course outline, and diving in to your first program.
    Download: history.pdf
  2. Simple C++ data types, how to use them, their representation, and more.
    Download: dataTypes.pdf       Example Code Used: click here.
  3. Selection control structures in C++: if, if/else, and switch.
    Download: controlStructures.pdf       Example Code Used: click here.
  4. Recent report from Money Magazine and I thought I would share and spend a few minutes talking about.
    Download: moneyMagazineReport.pdf
  5. A few comments regarding the last lab (lab 2)
    Download: lab2Comments.pdf
  6. Designing software
    Download: designOverview.pdf
  7. C++ Coding Style
    Download: codingStyle.pdf
  8. Looping structures in C++: while and for.
    Download: loopingStructures.pdf       Example Code Used: click here
  9. Some comments regarding Quiz 1
    Download: quiz1Notes.pdf
  10. An example of using good software design principles to complete Lab 3
    Download: designExample.pdf
  11. Functions in C++
    Download: functions.pdf       Example Code Used: click here
  12. Midterm Solutions
    Download:       Example Code Used: click here
  13. For a copy of the Homework 3 (approximating π and e) submission from the fellow student who created and used an arbitrary precision numeric library click here
  14. Arrays and vectors in C++
    Download: arraysAndVectors.pdf       Example Code Used: Arrays: click here Vectors: click here
  15. More about Perfect Numbers. One of you peaked my interest regarding perfect numbers, so I thought I would put together the following...
    Webpage: click here
  16. Searching and sorting lists
    Download: searchingAndSorting.pdf       Example Code Used: click here
  17. Pointers in C++
    Download: pointers.pdf       Example Code Used: click here
  18. Review for Final Exam
    Download: finalReview.pdf      


  1. Send me an email ASAP, with your name in it.
  2. The reading for the course is officially assigned as follows:
  3. IF you are an Engineering student and do not yet have an engineering login account THEN please go to the OCC office in 636 ERC and have them set you up with an account ASAP.
  4. Homework 1: This assignment is to get you used to working with designing solutions to problems. Anyone can write a program... you are here to learn how to design a good solution, and then implement it.
    Download: homework1.pdf
  5. Everyone here should be able to login to BlackBoard ( Any registered student at UC should have a login. In labs, we may be using blackboard. Please make sure you can login before Monday's lab. If you have any problems, contact UCit.
  6. Homework 2: Postponed until Monday. NOW AVAILABLE! For your entertainment! You are to write a program that allows a user to input a polynomial of arbitrary degree and evaluate that polynomial at a specific value of x.
    Download: homework2.pdf
  7. Homework 3: A menu-driven program requiring multiple nested conditionals and loops. The program should be able to calculate approximations for both π and for ex.
    Download: homework3.pdf
  8. Homework 4: A game of chance: using functions to simulate playing black-jack and keeping track of how much money the player (user) has won/lost.
    Download: homework4.pdf
  9. Homework 5: Create a program that plays Guess that Number, and then another program which plays the game you created in the first program.
    Download: homework5.pdf
  10. Homework 6: Extending homework 2 to store two polynomials and manipulate them in various fashions. Use of functions is required, and in fact critical, for a good, easy to follow design.
    Download: homework6.pdf

    ADDENDUM! You are to write your program implementing one of two provided APIs. When finished, the driver program (below) corresponding to the API you chose should compile and run as expected (shown in class).
    Download: homework6.addendum.pdf
    Example Driver for Array API: Hw6-Driver-Array.cpp
    Example Driver for Vector API: Hw6-Driver-Vector.cpp
    Output from Above Driver Programs: Hw6-Driver-Output.txt
  11. Final Project: Monkeys at typewriters... with style.
    Download: homework7.pdf

    Comments1/Hints 1: click here

    How to Read in a File: Below is an example of how to read in files, character by character, and "do something" with each character. Specifically, the example just outputs each character it reads. The net effect is that it simply outputs the file read.
    How to Generate Random Chars Based on a Distribution: This program illustrates how to first generate a random number between 0 and 1, and then use this number to generate a character from a list of characters with correpsonding frequencies.

    Sample Text Files: These are some sample text files that you will read in and test your programs against. For each, report your output (since your output may long, please just submit this digitally). In addition to the following files, I want you to run your program with the source code for your program, and report the output of that. Note that I will be posting more such files over the weekend, and you must report the output of those as well.

Lab Assignments

  1. Monday, 18 June 2007: These exercises are to help familiarize yourself with MS Visual Studio, including how to create a "Project" and store it locally, working with the debugger, and familarizing yourself with some common error messages. You also have to modify an existing program using an if control structure.
    Link to Assignment: click here
  2. Wednesday, 20 June 2007: These exercises are to let you work with various data types and how they behave. Also, more work with selection control structures such as if, if/else, and nesting.
    NOTE: Since few of you have a book for today, this lab will be rather easy/short compared to most. Expect them to require more thought and effort starting next week.
    Link to Assignment: click here
  3. Monday, 25 June 2007: These two excercises are to get you used to working with loops and nesting of various control/looping structures.
    Link to Assignment: click here
  4. Wednesday, 27 June 2007: This lab will work more with loops and condition statements. You must effectively use loops and conditionals in calculating values of π to various degrees of precision.
    Link to Assignment: click here
  5. Monday, 2 July 2007: This lab will require you to write functions and work with generating random numbers. The 4th part of the lab may be usefull for Homework 4.
    Link to Assignment: click here
  6. Monday, 9 July 2007: This lab will require you to write functions for converting between various measurements and also a program to test for perfect numbers.
    Link to Assignment: click here
  7. Wednesday, 11 July 2007: In this lab you will measure the randomness of the C++ rand() function by reporting the frequency of various random numbers. You will be required to use arrays, functions, and functions where you pass an array as a parameter.
    Link to Assignment: click here
  8. Monday, 16 July 2007: In this lab, you will write a vector-based insertion sort and then modify it to produce a decreasing version of the sort.
    Link to Assignment: click here
  9. Wednesday, 18 July 2007: In this lab, you have some rather tricky questions to answer regarding pointers. Should you finish the lab early, please feel free to work on your final project!
    Link to Assignment: click here

    For answers to the third question, click here
  10. Monday, 23 July 2007: In this lab, you will start to work with classes. Specifically, I created a "Polynomial" class that can be used to greatly simplify your homework 6 submissions...and that's exactly what you'll do.
    Link to Assignment: click here

Course Updates

  1. Monday, 18 June 2007: Office hours are established at Tuesdays and Thursdays, from 12:30 till 2:30 pm. Stop by my office at 805b Rhodes if you have questions. I am, of course, also available by appointment.
  2. Monday, 18 June 2007: REGARDING THE COURSE BOOK! We're still not sure how/why the book was not ordered by the book store. HOWEVER, you have a few options
    1. If you have a Credit/Debit card, you can order the book from with 2-day shipping for about $100.00 (which is still cheaper than what the Bookstore would offer it for).
    2. If you do NOT have a Credit/Debit card, call local bookstores. This is a pretty common book, so some of them will have copies.
    You must have this book for the course!
  3. Sunday, 24 June 2007: After realizing that we have two more days of class than I had previously thought, I have decided to postpone the assignment of homework 2 until Monday. Also, the Midterm will not be Friday, as planned, but rather next Monday.
  4. Sunday, 24 June 2007: After getting a little confused about the dates for this course, I put together an approximate schedule, mostly for my own benefit. You can view a copy here.
  5. Monday, 25 June 2007: Update on Lab Situation... Lab rooms for the remainder of the quarter will proceed as follows...
  6. Monday, 25 June 2007: I have updated the schedule (here) to reflect the July 4th holiday.
  7. Thursday, 5 July 2007: Quiz 3 was normally scheduled for tomorrow, but has been pushed back to Monday, 9 July 2007....we simply haven't covered enough of functions yet for me to quiz you on anything substantial. We will also have quiz 5 next week, on Friday, 13 July 2007 (Friday the 13th! Should make for a good quiz!)
  8. Friday, 6 July 2007: I have pushed back the due date for Homework 4 (the Blackjack program) to Wednesday, 11 July 2007 (due at start of class as usual). Homework 5 (the "guess a number" game) is still due Monday!.

Grading of the Course

As described in class, the grading for the course will be broken down as follows. I thought I'd post the exact grading scheme also... each percentage point in the class is worth 10 points, so there will be a total of 1,000 points in the class. Details below. So, you can follow along in class and keep track of your grade if you like.

Attendance: 5% 50 points
Quizzes: 5% 50 points (with 5 quizzes each is 1% / 10 points)
Midterm: 15% 150 points
Final: 20% 200 points
Lab-Assignments: 20% 200 points (with 10 labs each is 2% / 20 points)
Homeworks: 35% 350 points (3.5% / 35 points per homework)
Note: The 9th and final homework will be worth twice as much, so 7% / 70 points of your grade.
Total: 100% 1,000 points