B1;2cB COMP-202A Course Materials - Winter 2012
Introduction to Computing 1 -- Lecture Slides Dan
Winter 2012


Lecture slides and related source code will be posted by Dan here.

Dan's Lectures

Date Topic(s)
2012-01-09, 2012-01-11 (approximate) Introduction
  • (lecture)
  • Running a program
  • HelloWorld.java You can download this version directly. If you cut and paste in to notepad then make sure to be careful that the file is exactly HelloWorld.java and not helloworld.java or HelloWorld.java.txt or "HelloWorld.java"
  • If you are having trouble finding the jdk 6 for windows 64 bit systems on the new layout of the page, you can try the following link. http://download.cnet.com/Java-SE-6-0-JDK-6/3000-2212_4-10857945.html
  • I put together a list of some helpful command line tips to help you navigate the terminal: Command line tips You may find this useful in trying to run java from the command prompt or terminal window.
2012-01-13, 2012-01-16 Planning; Basics on Computer memory; Basic Java structure
2012-01-16, 2012-01-18, 2012-01-20 Variables, expressions, and types; Reading from the keyboard; Writing to the screen.
2012-01-23, 2012-01-25, 2012-01-27, 2012-01-30 Using library methods, writing your own methods, if statements, boolean expressions, and comments.
2012-02-01 Loops and iterative methods: while loops, for loops, nested loops, static variables.
  • Unit4 (updated February 7th to include warmups and a couple exercises)
2012-02-08, 2012-02-12, 2012-02-14 Arrays, Basics of reference types, Examples of loops
2012-02-16 through 2012-09-03 Object Oriented Programming basics
  • Unit6 (draft)
  • Card.java Card example mentioned in class. It should be viewed at the same time as CardGame.java . Note that this example is very similar to what you will have to do in question 1 and 2 of the 3rd assignment.
  • CardGame.java
  • notes-complexnumbers.txt
  • ComplexNumber.java
  • MathProgram.java
  • Recipe Example: version 1 (multiple arrays)
  • Recipe Example: version 2 (Ingredient object to simplify the Recipe class. Notice that LasagnaChef is completely identical to what it was before. We can do this since we left all the public methods the same. Had our properties been public, we would not have been able to do this without updating many other files. This is very common: You design a type initially on day X to do something, but then later on, you realize that it would have been better if you designed it in a bit better way. It is important in that case to minimize the number of changes we have to make or else there is a good change we'll make an error)
  • Person.java (Example to illustrate issues with references/aliasing)
  • HockeyFriendships.java (related to Person example above)
2012-03-12, 2012-03-14, 2012-03-18 More advanced objects/generics: ArrayList, HashSet, HashMap
Week of March 19th, March 26th Recursion
  • Unit8 (updated March 24th)
  • Fibonacci.txt
  • FibSlow.java (This took 1 hour to run on my computer and calculate fib(55). If you increase the size of the input by 1, I expect it to be 2 hours, increase by 2 is 4 hours, etc. Each time you increase the size by 1 it doubles the size)
  • FibFast.java (This was basically instantaneous to calculate fib(65). The biggest limitation is running into the maximum size of an int. Perhaps we could use long to avoid this issue or at least delay that)
  • WordDistance.java (compiles and runnable)
  • SpellChecker.java (compiles and runnable)
  • The spellchecker main method requires a file to be present in the same folder as the .java file. The file is a dictionary of all the words you want to compare it with, one word per line. I have tested on 2 sample dictionaries: one of all the hockey teams and one of an English dictionary I found on the web. The English dictionary is too big and at least on my computer the program doesn't terminate.
  • HockeyDictionary.txt A small dictionary that works with the spell checker
  • Dictionary.txt A large dictionary that is too big for my computer to handle the recursion of EACH word on
  • Point.java (used with NavigateMaze.java example)
  • NavigateMaze.java (compiles and runnable)
  • RecursionExamples.java More recursion examples (done in class during review)
week of April 2nd Exception Handling
  • Unit9 Updated: Fixed mistake in Fahrenheith converter. Added a command on slide 25 to, inside the catchblock of code add reader.next() which is necessary to remove the bad text from the scanner line. (This is needed in your assignment.) From the Scanner documentation. "When a Scanner throws an InputMismatchException, the Scanner will not pass the token that caused the exception, so that it may be retrieved or skipped via some other method."
  • DownloadPages.java (example of using try/catch)
week of April 2nd Extra stuff (not examinable)