CSC 222: Object-Oriented Programming
Spring 2017
Final Exam Review
Course goals:
- To know and use basic Java programming constructs for object-oriented problem solving (e.g., classes, polymorphism, inheritance, interfaces)
- To appreciate the role of algorithms and data structures in problem solving and software design (e.g., objected-oriented design, lists, files, searching and sorting)
- To be able to design and implement a Java program to model a real-world system, and subsequently analyze its behavior.
- To develop programming skills that can serve as a foundation for further study in computer science.
Course content:
Object-Oriented Concepts
design goals
abstraction, object-focused, modularization
classes/methods should be highly cohesive & loosely coupled
Model-View-Controller (MVC) pattern
class/object concepts
class vs. object, fields & constructors & methods
private vs. public, static, final
interfaces & polymorphism
List interface, Comparable interface, Collections.sort
class hierarchies: e.g., Grade --> LetterGrade, passFailGrade
inheritance & polymorphism
derived class, parent class
inheriting methods/fields, overriding methods
class hierarchies: e.g., BankAccount --> SavingsAccount, CheckingAccount
Java Specifics
types
primitive types: int, double, char, boolean
object types: String, Integer, Double, ...
enumerated types
expressions
String: +
math: +, -, *, /, %, +=, -=, *=, /=, %=, ++, --
boolean: ==, !=, >, <, >=, <=, &&, ||, !
statements
assignment, print, return, if, if-else, while, for, for-each
method calls: internal (this.METHOD()) vs. external (OBJ.METHOD())
exception handling: throws, try/catch
libraries
String, Character, Collections, Random, ...
I/O
formatted output: System.out.format, format strings
Scanner: hasNext, next, hasNextLine, nextLine, hasNextInt, nextInt, ...
FileWriter: write, close
Data Structures
arrays and ArrayLists
advantages of ArrayLists over arrays
methods: add, remove, set, get, size, ...
parallel arrays/ArrayLists
Dictionary example: add, contains, size, display
implementation built on top of ArrayList, generic
unsorted vs. sorted vs. "lazy" sorted versions
Algorithms
algorithm analysis
big-Oh notation, rate-of-growth
worst case vs. average case vs. best case performance
searching & sorting
sequential search O(N) vs. binary search O(N log N)
Collections.binarySearch, List & Comparable interfaces
insertion sort O(N^2) vs. selection sort O(N^2) vs. merge sort O(N log N)
Collections.sort, Collections.shuffle
recursion
base case(s), recursive case(s)
avoiding infinite recursion, Cat in the Hat analogy
recursion vs. iteration: efficiency tradeoffs, redundancy
simulations and modeling
Assignments
1. classes & objects (HoopsScorer)
2. repetition & simulations (roulette betting)
3. files, strings & lists (literary stats)
4. arrays & data structures (quiz list)
5. objects & data structures, MVC (Hunt the Wumpus)
X. CodingBat extra-credit problems