teaching machines

CS 145 Lab 10 – Objects and ArrayList

Welcome to lab 10! If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab. In this lab you will create our own […]

CS 145 Lecture 30 – ArrayList

Dear students, Arrays make the modern world happen. The computer itself can be viewed as one big array, lining up all our data, music, photos, and movies on disks and in RAM. However, arrays have their limits. In particular, arrays are fixed in size. We need to know their size when we create them. Sometimes […]

CS 145 Lecture 29 – Arrays in Two Dimensions

Dear students, We’ve seen that we can create an array like this: type[] id = new type[#]; That type can be anything, like int, String, double, boolean, BufferedImage, and so on. It can also be another array: type[][] id = new type[#][]; Just as 1D arrays let us use one integer to map into a […]

CS 145 Lecture 28 – Arrays * 4

Dear students, With arrays, we are treating the computer as a factory worker, performing some automated task on every item rolling through an assembly line. It’s these mindlessly repetitive tasks that make computers so compelling. While they do the grunt work, we can move on to a more intellectually-challenging exercise, like getting the machine running […]

CS 145 Lecture 27 – Array Patterns

Dear students, After you solve a few array problems, you start to see some regular patterns emerging in your algorithms. Today, we break down a few of those patterns. The payoff of cataloging these is that the next time we encounter an array problem, we can apply the general structure and save our labor and […]

CS 145 Lecture 26 – Arrays Cont’d

Dear students, Today we continue looking at the data that we collected last time: The number of children your grandparents had (i.e., the number of parents you have plus their brothers and sisters). For example, I have two parents, three uncles, and two aunts, so I’d report 7. The number of children your parents had, […]

CS 145 Lab 9 – Arrays

Welcome to lab 9! If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab. You must work with a partner that you […]

CS 145 Lecture 25 – Arrays

Dear students, Today we begin our descent into the world of collections of data. No longer will we be content with one or two numbers—we want them by the hundreds! For our first problem involving a data collection, we’ll look at testing whether or not a six-sided die (d6) is fair. We could do it […]

CS 145 Lecture 24 – Animation

Dear students, Let’s start with a Program This! Write a method times with the following behavior: times(‘!’, 3) yields “!!!” times(‘#’, 6) yields “######” times(‘-‘, 13) yields “————-” We’ll use this method to generate a random spelunking workout. After that, we’ll generate a few more images. This time we won’t use loops to march through […]

CS 145 Lecture 23 – Images Cont’d

Dear students, I believe the ideas of computer science are best illustrated by manipulating digital media. To me, digital media presents a perfect context: it is one you are familiar with, and it is one that has real-world relevance. I’m sorry if you were hoping to work more with text and numbers. For those of […]

1 2 3 4 7