Computer Science 252
Problem Solving with Java
Spring 2015, The College of Saint Rose
Class Examples
Class examples will be linked below. Please report any missing examples.
- Java Review and Objectdraw Basics
-
- Defining Classes
-
- NiceBasketball - a fancy-looking basketball (that
just sits there)
- Arcs - examples of FramedArc and
FilledArc objects
- FancyBasketball - a class defining a fancy
basketball which is used by another class to play our basketball game
- DrawBBalls - lots of instances of the basketball
- Drag2Shirts - two instances of a custom object
- DragCars - example of another custom object with
lots of methods
- DoNotEnter - another example of another custom object
- BookGame - yet another example of a custom object
- Repetition and Active Objects
-
- Java Interfaces
-
- ShirtsAndPants - a Java interface to allow multiple laundry types
- FallingThings - using Objectdraw's Drawable2DInterface to have a generic "falling thing" implementation
- HandlingArrowKeys - how to handle arrow key
presses and releases.
- Swing
-
- Recursive Structures and Methods
-
- NestedSquaresLoop - loop-based nested squares
- NestedSquaresRec - recursive constructor for nested squares
- NestedSquaresDrag - drag around nested squares using recursive data structure and recursive move method
- BigSnowman - another example of a recursive constructor and methods
- NestedSquaresSizes - drag around nested squares but with multiple sizes, ability to set color or get info using recursive methods
- Powers - compute powers (base raised to an
exponent) iteratively and recursively
- SimplestRecScribbler - defining a recursive
scribble data structure
- SimpleRecScribbler - using the recursive scribble
data structures
- RecWoodPile - a stack of wood to which we can add
logs or remove logs only from the top
- ChainReaction - another recursive data structure, combined with some animation
- RecScribbler - adding a list of scribbles to allow dragging/coloring of all existing scribbles
- Broccoli - a recursive structure representing a piece of broccoli
- BroccoliBetter - a recursive structure representing a piece of broccoli using an interface to simplify code
- LivingFractal - build a fractal shape recursively with an active object
- Collections
-
- Strings and Characters
-
- Hangman - the word guessing game, demonstrating
more String and char/Character manipulations
- Concurrency
-
- ATM1 - demonstrating the dangers of concurrency
- ATM2 - demonstrating the dangers of concurrency
- ATM3 - demonstrating how to avoid the dangers of concurrency
- Programming Without Objectdraw
-
- Wrapup Examples
-
- TicTacToeSwing - a GUI version of the Tic-Tac-Toe game
- FiveGuys - a very complex Swing GUI for ordering
your burgers and fries