teaching machines

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 […]

CS 145 Lab 8 – Spinner

Welcome to lab 8! 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 22 – Images

Dear students, We start today by revisiting memory tracing, but this time in programs with loops. Here we go! Memory Tracing #1 public static String trace1(char c, int n) { String s = ""; for (int i = 0; i < n; ++i) { s += c; } return s; } public static void main(String[] […]

CS 145 Lecture 21 – Loops Cont’d

Dear students, Let’s start with a little Program This: Write a method indexOf that accepts a String and a char as parameters. Without using the builtin String.indexOf method, it returns the index at which the given character resides in the String. If no such character can be found, return -1. Then, let’s seem some more […]

CS 145 Lab 7 – Loops

Welcome to lab 7! 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 20 – For

Dear students, Hey. Check out this while loop: int i = 0; while (i < 5) { System.out.println(i); ++i; } Let’s abstract this out a bit into its four parts and pieces: init while (condition) { body; update; } Loops are powerful, but any time you put a motor in something, it gets away from […]

1 8 9 10 11 12 35