CSC 221: Computer Programming I
Fall 2005
- To develop problem solving and programming skills to enable the student to
design solutions to non-trivial problems and implement those solutions in Java.
- To master the fundamental programming constructs of Java, including variables,
expressions, classes, methods, control structures, and arrays.
- To build a foundation for more advanced programming techniques, including
object-oriented design and the use of standard data structures (as taught in CSC
222).
GENERAL KNOWLEDGE
overview & history: hardware vs. software, technology generations, ...
object-oriented design: approach to problem-solving, manage complexity, ...
problem-solving skills, critical thinking skills, communiation skills
JAVA LANGUAGE FEATURES
classes & objects
using classes, Java libraries, calling methods on objects
class definitions
fields: private, data types (int, double, char, boolean, String), static
methods: public (usually), parameters, local variables, return
constructor(s): same name as class, no return type
examples: Die, Dot, DotRace, Notebook, Word, Document, Card, DeckOfCards
Java statements
assignment: variables, expressions, operators (+, -, *, /, ++, --, +=, ...)
output: System.out.print, System.out.println
return: returns value from method
local variable declaration: primitive vs. reference types (objects)
if: conditional execution, if, if-else, cascading if-else
Boolean expression, operators (==, !=, <, ...), connectives (&&, ||, !)
while: conditional loop, Boolean expression
for: counter-driven loop, equivalent to while but clearer
String class
methods: +, length, charAt, substring, indexOf, equals, compareTo
Scanner class
methods: next, hasNext, nextInt, hasNextInt, nextDouble, hasNextDouble
File class, type casting, exception handling
ArrayList class
methods: add, get, set, size, remove, contains, indexOf, toString
parallel lists vs. structured lists
autoboxing/unboxing, array alternative
PROGRAMMING TECHNIQUES
object-oriented design principles
classes model real-world entities
methods implement behaviors, provide for coputational abstraction
fields maintain state of an object (final for constants, static for shared)
classes/methods should be cohesive; classes should be loosely coupled
conditionals for alternatives (1-way if, 2-way if-else, multi-way cascading if)
loops for repetition (conditional while loops, counter-driven for loops)
counters & sums for collecting data
String traversal/concatenation for manipulating text
Scanner + File classes for reading and processing files
ArrayLists for storing and accessing large amounts of related data