CSC 221: Computer Programming I
- 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
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
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, Card, DeckOfCards, ...
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
methods: +, length, charAt, substring, indexOf, equals, compareTo
methods: next, hasNext, nextInt, hasNextInt, nextDouble, hasNextDouble
methods: add, get, set, size, remove, contains, indexOf, toString
object-oriented design principles
classes model real-world entities
methods implement behaviors, provide for computational 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 class for reading user input
ArrayLists for storing and accessing large amounts of related data