CS 145 Lecture 12 – Test-driven Development
Dear students, Last lecture I said we’d have one more day of focus on methods, but then we spent the entire time talking about casting. Today we’ll start the fill-in-the-blank exercises to exercise our method brain. Your task is to jot what goes in each blank of the following code snippets. One of the blanks […]
CS 145 Lab 4 – Methods
Welcome to lab 4! If you have checkpoints from the last 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 have […]
CS 145 Lecture 11 – Methods x4
Dear students, Let’s do one more of the exercises from last time! Middle public class Middle { public static void main(String[] args) { char a = ‘a’; char e = ‘e’; char middle = average(a, e); System.out.println(middle); } public static char average(char c1, char c2) { return (c1 + c2) / 2; } } This […]
CS 145 Lecture 10 – Methods and Memory
Dear students, Whoever you are, you need practice with methods. They are a concept that you probably didn’t encounter in your high school math classes, and you have no prior knowledge on which to build here. So, don’t be too hard on yourself if they don’t click immediately. Today, then, we devote our entire time […]
CS 145 Lecture 9 – Blackboxes
Dear students, We have seen methods as a means of capturing a process into a reusable component. Methods have some really nice advantages: They drop us into a smaller world with a smaller problem to solve. Instead of thinking about the grand mission of our program, we think about the baby step of the method. […]
CS 145 Lecture 8 – Methods Cont’d
Dear students, Last time we started generating some circle art, but we stopped with only one circle. Once we get that working, let’s add a second random circle. And a third. And a fourth. And so on. We’ll find that the code quickly gets away from us if we simply copy and paste. Instead, we […]
CS 145 Lab 3 – Methods
Welcome to lab 3! If you have checkpoints from the last 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 have […]
CS 145 Lecture 7 – String Cont’d and Methods
Dear students, With Strings at our disposal, our programs are going to start to feel human. We can write programs that process and generate words, and that’s pretty amazing! But we need more practice using them before we determine the authenticity of Shakespeare’s works. Let’s play some Stringo! Generate a String of five characters. Use […]
CS 145 Lecture 6 – The String Class
Dear students, If this class was a book, the chapter we’re in right now is Computer as Calculator. I’d mentioned that computers got their start in the world of mathematics. Why exactly did computers start with the mathematicians? Lately I’ve been reading some graphic novels related to technology and computer science for a conference I’ll […]
CS 145 Lecture 5 – Math Cont’d
Dear students, Here’s something that happens. Your professor, who has been writing code for a long time, walks through many coding examples with you in class. He carefully arranges everything to present a coherent and compelling story, intentionally leading you into problems but swooping in with some new idea to save the day. You feel […]