CMPS 12A: Introduction to Programming
Winter 2012

Prof. Scott A. Brandt

Computer Science Department
University of California, Santa Cruz


3/18/12 - As a reminder, I will be holding my office hours at the usual times this coming Monday and Wednesday.

3/18/12 - Apparently, the department forgot to open up seats in 12M, the lab associated with 12B. I let the Chair know and I trust the problem will be fixed so people can enroll in 12B.

3/17/12 - Another sample final exam: Sample final

3/17/12 -

GOOD NEWS: CMPS 12B has been increased to hold 105 students --- there are 55 seats available as of this morning.

3/16/12 - Solutions to the midterm:

  • Version A
  • Version B

    3/13/12 -
    The FINAL EXAM will be Thursday, March 22 from 8:00-11:00 in the usual classroom.
    Bring your official UCSC picture ID with you to the exam and be prepared to show it upon submitting your exam.

    3/13/12 - Assignment 7 is now posted. Due to the short time left in the quarter, I have made it optional and EXTRA CREDIT. It is due any time before 5:00 pm on the day of the Final Exam (Thursday, March 22).

    3/8/12 - More example code -- our character counting program. It takes as input, one the command line, the name of a file to count the alphabetic characters in. Run it like this:
        java CharCount book.txt
    (assuming you want to count the characters in a file named book.txt).
    You may copy and modify code from this example, for example the file reading code, for use in your cryptography program.


    2/27/12 - As we approach the end of the term, I am adding another set of office hours.

      My office hours for the rest of the quarter are:
    • Mondays 3:30-5:00
    • Wednesdays 10:30-12:00
    • Fridays 11-1

    2/27/12 - More program examples:

    2/27/12 - My office hours will be 1/2 hour shorter today, from 3:30 to 4:30 (instead of 5:00), due to a medical appointment.

    2/22/12 - Midterm 2 will be on Friday, March 2.

    2/15/12 - Some problems we will work on Friday: Ch. 4, Exercises 8, 15, and 17.

    2/13/12 - I have decided to make assignment 5 a two-week assignment.

    We will do it in stages:
    1. Create the array, initialize it, and print it out
    2. Create a mechanism for updating the array based on a single rule, then update the array once and print it out
    3. Create a loop that applies the rule over and over, printing out the array after each step
    4. Generalize it to work with any rule
    5. Simplify and refine the implementation

    2/13/12 - Some program examples:


    2/1/12 - Midterm 1 today.

    Here is a link to the current version of Javadoc


    1/25/12 - Interesting talk today: The Chief Information Officer of the New York Stock Exchange will be talking today at 1:00 in E2-180 about some of the real-time computing needs of the stock exchange. I encourage all of you to attend, if you are free at that time. It should be very interesting and highlights some of the impact of our work as Computer Scientists in the real world.


    1/23/12 - As explained in class on Friday, we will use eCommons for all homework assignments and submissions. The assignments will be posted there and all submissions must be via eCommons.

    All assignments starting with #1 will be graded and all must be turned in before the lab following the one in which the assignment is discussed. (The due date posted on eCommons is the latest possible, but your actual due date depends upon which lab you are registered for).


    1/18/12 - To log into the Unversity UNIX systems from your own computer, you need an ssh program. To get putty, a good ssh program for the PC, click here. To use it, enter "" in the Host Name box, then click on the Open button. Then log in with your username and CruzId Blue password. Now you can start entering unix commands to run on the University's unix systems. Any files you create will be in your Unix home directory on the University systems.

    1/12/12 - Click here for a $5 ebook version of the book!

    1/12/12 - Click on the "Labs" link at the top of this page to get information about how to get started with the programming assignments. I also recommend that you read the FAQ and Info sections of the site.

    1/12/12 - Click here for the HelloWorld program we wrote in class.

    1/9/12 - Welcome to CMPS 12A. Look here for important news about the class.

    Ongoing - I am in the process of updating these web pages. They currently contain information from a previous quarter. I'll let you know when everything is current. In the mean time, feel free to browse around, as relatively little will change.

  • Time: MWF 2:00-3:10
    Location: Kresge 321
    Instructor: Prof. Scott A. Brandt (
    Office/Office Hours: E2-347B, Mondays 3:30-5:00 and Wednesdays 10:30-12:00
    TAs: Sali Serdar ( and Dimitris Skourtis (
    TA Office/Office Hours: Sali: Tuesdays 12-2 in E2-392, Dimitris: Thursdays 2-4 in E2-375
    Lab Hours: BE 105: M 4-6, T 2-4, W 4-6, Th 12-2, Fr 10-12
    Prerequisites: Eligibility to enroll in Mathematics 19A (Mathematics 2B or 3 or 40 or higher on mathematics placement exam) or Mathematics 19A or 11A or Economics 11A or Applied Mathematics and Statistics 11A.Concurrent enrollment in course 12L required.
    Required Text: Java by Dissection, 2nd Edition, by Pohl and McDowell
    Optional Text: Any other Java book
    Course Web Page:
    Class Newsgroup: ucsc.class.cmp12a

    Course Notes

    This page contains the lecture notes for the course. I will put them up as soon as possible, but I may not always be able to do so before the corresponding class period.

    General Lab Information

    This section contains general information about things you will need to know how to do in order to do well in this class (and future classes as well). It includes information on using Unix, creating a program, and submitting homework assignments. If you need additional background information, you should definitely check out the resources CATS (Communications and Technology Services) provides. They are located downstairs in the Communications building. If you don't yet have a CATS account, click here to register.

    TAs and Tutors

    This section contains information about the lab times and when the TAs and tutors are available.

    Lecture Supplements

    This section contains additional information from the instructor to supplement the lectures. Materials will be added here as they become necessary.

    FAQ (Frequently Asked Questions): See if your question is here!

    This section contains some questions pertaining to programming which students frequently ask.

    Required Text:

    Java by Dissection, 2nd edition
    Pohl and McDowell
    Lulu Marketplace

    Optional Supplemental Text:

    Thinking in Java, 3rd edition


    12A Evaluation:

    • 2 Midterms (25% each).
    • Cumulative Final (50%).

    12L evaluation:

    • Attendance (25%)
    • Assignments (75%)

    You must pass 12A to pass 12L and vice versa.

    Academic Honesty

    All course work, excluding pair programming assignments, are intended as individual effort and are graded as such. It's okay to discuss general approaches and algorithms with other students, but this must be done without sharing code. Do not look at or copy other people's programs or allow them to look at or read yours. An automatic program may be used to detect copying. Cheating or plagiarism in any form will not be tolerated. Punishment may include an automatic FAIL with an explicit discussion in the permanent narrative evaluation records. You are responsible for protecting your homework solutions and programs from being copied by others. Do not discard printouts in public places. And don't forget to logout. Look at the campus policies regarding academic integrity for more details.

    Academic Dishonesty: Any confirmed academic dishonesty including but not limited to copying programs or cheating on exams, will constitute a failure of the computer ethics portion of this class and may result in a no-pass or failing grade. You are encouraged to read the campus policies regarding academic integrity.

    Facilities: This quarter you will using the Unix operating system for your programming assignments. You will use submit for turning in homework.

    Homework: Turn in homework by using the submit procedures. It will not allow late work. Late work will not be accepted or graded. The program should be submitted in whatever form it is in - it is possible to receive some partial credit for a program that is not working. Homework is graded in terms of it being done in a good style, being correct, being concise, being readable, and being efficient.


    Audience: This course is for CS, CE and ISM majors and prospective majors. These are disciplines which emphasizes mathematics and problem solving. There are computer literacy and computer programming courses that are offered for the non-major. If you are shaky in your preparation you should consider taking CMPS010, which is highly recommended for all CS majors.


    Date Topic Reading
    Week 1 Class Overview, Introduction Chapter 1
    Week 2 Program Fundamentals Chapter 2
    Week 3 Statements and Control Flow Sections 3.1-3.4
    Week 4 Statements and Control Flow (cont) Chapter 3.5-3.10
    Week 5 Functional Abstraction Chapter 4
    Week 6 Functional Abstraction Chapter 4 (read it again)
    Week 7 Arrays Chapter 5
    Week 8 Arrays (cont), Data Abstraction Chapter 5, Sections 6.1-6.8
    Week 9 Data Abstraction (cont) Chapter 6
    Week 10 Data Abstraction Chapter 6

    Telephone: (831) 459-5042 / FAX: (831) 459-4829 /