CPSC S112
CPSC S112
Summer, 2023
Course Description
CS112 is an introductory programming course, using the Java programming language.
There is no prerequisite for the course -- in particular, no prior programming experience
is required -- although it helps to be "computer literate."
By the end of the course, you should be able to write useful Java programs, but the
focus of the course is programming concepts. Besides learning how to write cool
programs you will focus on learning data types (arrays, strings, numbers, lists, queues,
stacks, etc.), control structures (conditionals, loops, exception handling, recursion, etc.),
program analysis (assertions, etc), basic algorithms (sorting, searching, etc.), object-
oriented programming (classes, methods, objects, inheritance, polymorphism, interface,
etc.), and basic libraries (graphics, digital audio, text processing, etc.).
Course Format
This course has three mandatory 2:15 hour lectures and an optional discussion section
each week. The lectures present the majority of the course content, while discussions
reinforce the concepts. The discussion sections will present exercises and examples
useful for the problem sets.
• Stuart Reges and Marty Stepp. Building Java Programs: A Back to Basics
Approach.
URL: http://www.buildingjavaprograms.com.
An additional online book from which we will draw examples and exercises:
• Ask others or search online for help with general issues with programming
languages, APIs, IDEs, tools, and high-level course concepts that are not
specific to the assignment.
• Ask clarifying questions about the requirements of an assignment to TAs or on
the course discussion board.
• Discuss more specific issues on an assignment with a TA or instructor.
You may not:
If you have any questions about this policy or are unsure if you may have crossed a line,
discuss it with the instructor as soon as possible.
Syllabus
The following is a tentative (subject to change) schedule of lecture content and
assignemnts.
GUI Framework
1. Introduction
o Introduction
o Java program structure
2. Elements of Programming
o Static methods and method decomposition (Top-down design,
bottom-up implementation)
o Data types; Primitive data types; Operators and expressions; Data
type conversions; Assignment operators
o Basic for loops; Loops and coding style; Variable scoping; Nested
loops; ASCII figures as loop examples
o Parameterized methods
o Java graphics; Examples of parameterized drawings and loops;
Animations
o Methods with returns; Summary of static method definition and
invocation
o Text I/O: Input using Scanner; Exception handling; File
input/output; Text output using printf/format
3. Basic Program Flow of Control and Basic Arrays
o Logical conditions (Boolean expressions); Boolean type
o Nested if/else
o Conditional shortcuts (switch, conditional operators)
o Strings processing with conditional
o String as an array of chars; Text encryption/decryption
o Array of Strings; Using array as counters (histogram)
4. Indefinite Loops using while, do/while
5. General Program Flow of Control: Indefinite Loops
1. Program analysis; Loop pattern: sentinel input/fencepost
2. Loop examples of various patterns
6. General Arrays
o Array algorithms, Array reference semantics
o Arrays and digital audio; Multidimensional arrays
o PageRank
7. Object-oriented Programming (OOP)
o User-defined type: encapsulation of data+code
o OOP design and analysis
o The OOP Encapsulation Principle
o OOP examples: Random vs Math.Random; StdDraw vs
DrawingPanel; Complex numbers and fractal graphics
8. Class Relationship; Inheritance/Polymorphism
o Class relationship: Composition, association, inheritance
o Inheritance and object construction; Method override
o Inheritance hierarchy (Critters hierarchy as an example)
o Event-driven programming (Critters with coordination)
o Polymorphism
o Interface
9. Programming with generic types: Sorting, searching
10. GUI Frameworks