teaching machines

CS 145 Lecture 18 – Common array algorithms

Agenda summarizing optimizing filtering linear search state-capital lookup TODO Read sections 7.3-7.4. Reverse Engineering Code CapitalLookup.java package preexam2; import java.util.Scanner; public class CapitalLookup { private static String[] states = { “Alabama”, “Alaska”, “Arizona”, “Arkansas”, “California”, “Colorado”, “Connecticut”, “Delaware”, “Florida”, “Georgia”, “Hawaii”, “Idaho”, “Illinois”, “Indiana”, “Iowa”, “Kansas”, “Kentucky”, “Louisiana”, “Maine”, “Maryland”, “Massachusetts”, “Michigan”, “Minnesota”, “Mississippi”, “Missouri”, […]

CS 145 Lecture 17 – Birthday problem II

Agenda test April 13, covering logical operators, if statements, and arrays review session? evaluating a postfix expression finding birthday repeats accumulating or minimizing with the soFar pattern implementing a raffle TODO Start preassignment 3. Code Birthday.java package preexam2; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Birthday { public static void main(String[] args) throws FileNotFoundException […]

CS 145 Preassignment 3 – due before Monday, April 16

See the PDF. I strongly suggest you finish this preassignment before the exam on April 13, so that you may benefit from its completion on the exam. Homework 3 will be assigned immediately after this assignment is due.

CS 145 Lab 8 – Arrays

Prelab There is no prelab problem this week. Reminder Show your completed lab 7 checkpoints to your instructor or TA in the first 20 minutes of this lab. Array usage As discussed in class and in your textbook, arrays are simply number collections of data. We can have arrays of primitives and we can have arrays of […]

CS 145 Lecture 16 – The birthday problem

Agenda the birthday problem Program This Odd rows: You are given a month and day, both as numbers. What day within the year is it? Write down your algorithm in pseudocode. Even rows: You are given a day of the year, in [1, 366]. What month and day is it? Write down your algorithm in pseudocode. […]

CS 145 Lecture 15 – Arrays

Agenda calculating a histogram serializing data with arrays turning a month number into a month name turning a month/day into a day of the year TODO Read sections 7.1 and 7.2. Program This You are given a month and day, both as numbers. What day of the year is it? Write down your algorithm in […]

CS 145 Lecture 14 – Android diversion

Agenda the Activity event-driven programming vs. what we’ve been doing peeking into classes and inheritance a random restaurant chooser a music composer Code RandaurantActivity.java package org.twodee.randaurant; import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.widget.TextView; public class RandaurantActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public boolean onTouchEvent(MotionEvent […]

CS 145 Lecture 13 – PrintWriter and Patterns

Agenda PrintWriter and snowpeople the so-far pattern doing a word count the fencepost pattern prompting for a valid file So-far (Cumulative) pattern We can only work on one thing at a time. When problems require processing of a set or list, we’ll have to apply the so-far pattern: Fencepost pattern Suppose we want to print […]

CS 145 Lab 7 – More on loops and conditionals

Prelab Complete Self-Check 5.28 on the Practice-It website before 8 AM on March 26. Reminder Show your completed lab 6 checkpoints to your instructor or TA in the first 20 minutes of this lab. Cards Each of today’s problems involves a deck of cards. Though we use card terminology, you do not need to have […]

CS 145 Homework 2 – due before Thursday, March 29

See the PDF.

1 26 27 28 29 30 35