Computer Science 112 Spring 2015
Gregory M. Kapfhammer
Introduction to Computer Science II
Review Content
Compiler
Inputs?
Outputs?
Purpose?
Virtual Machine
Inputs?
Outputs?
Purpose?
Opportunities
Challenges
Halting Problem
Iteration Constructs
Limited Resources
Conclusions?
More about iteration
git pull
WhileLoopExample.java
Does this program halt?
Can you fix it?
How did you fix it?
Chaos Theory
LogisticMap.java
Compile
java LogisticMap 0
java LogisticMap 0.825250
Investigate
Split points?
Departure into chaos?
Discuss iteration
How does it work?
Make sure you understand!
Greatest Common Divisor
IterativeGCD
How does this program work?
Timing Experiment
RecursiveGCD
How does this program work?
Timing Experiment
Which one is faster?
Why?
Factorial
IterativeFactorial
How does this program work?
Timing Experiment
RecursiveFactorial
How does this program work?
Timing Experiment
Which one is faster?
Why?
Compare and Contrast
Why is this result evident?
Will the result ever be different?
Random
Import Statements
Data Types
Primitives
Objects
Numbers
Memory Addresses
Testing
Debugging
java junit.textui.TestRunner TestKinetic
java junit.swingui.TestRunner TestKinetic
Defect?
Fix It!
Understand
Start from Scratch!
Count off by sixes
Sorting
Swapping
swap(int a, int b)
swap(Integer a, Integer b)
What?
Why?
Impossible?
Possible?
How?
Review Solutions
Object-Oriented Design
Abstraction
Encapsulation
Modularity
Figure 2.2 on page 61
Inheritance
Polymorphism
Interfaces
Abstract Classes
Exceptions
Casting
Arrays
Indexing and Array
Let's try it!
CaesarCipher example
Modify this program
Create a new plaintext!
TicTacToe example
Modify this program
Introduce a new game play
ArrayLists
Arrays that can grow and shrink in size
Sorting
Putting the contents of the array in order
Ascending
Descending
More in the laboratory assignments!