/* An instance is a bird */
public class Bird extends Creature cfw_
/* set of Birds in the zoo.
* (Elements should also be listed in the zoo) */
/ public for the purposes of example
public static Bird aviary;
/* Constructor: a Bird with name
/* An instance is a zoo creature */
public class Creature cfw_
/* This Creature's name */
private String name;
/* set of Creatures in the zoo*/
/ this field has been set to public to make this running example
/ shorter to present
/* Checker-playing application
public class TrivialApplicationcfw_
public static void main(String args) cfw_
System.out.println( "The game of Checkers!" );
Checkers game= new Checkers();
/ An instance of IntLabel is an integer that is associated
/ with a Label that appears on the GUI. The purpose of having
/ a class for this is to ensure that whenever the integer is
/ changed, the corresponding Label is also changed.
/* An instance keeps information about a chapter
* of a book */
public class Chapter cfw_
/ class invariant: set of meaning of fields and constraints on them
private int number; / the chapter number, in range 0.100
private String title; / chapter ti
* A JUnit test case class.
* Every method starting with the word "test" will be called when running
* the test with JUnit.
public class ChapterTester extends TestCase cfw_
* A test method.
* (Replace "X"
/* Contains static methods for sorting, together with the methods
that they use. Included are:
min, to find the minimum of b[h.k]
insertValue, to insert a value into its sorted position in b[h.k-1]
medianOf3, used in quicksort
/* Demo for lecture on 19 February */
public class Demo cfw_
/* = number of 'e's in s.
Example: noe("e ebe") = 3. */
public static int noe(String s) cfw_
if (s.length() = 0) / BASE CASE
/ s has at least 1 character, so:
/ (number of
/ Frame for the game Checkers. The frame contains the game
/ board and necessary buttons and information fields.
public class Checkers extends Frame cfw_
/ Components that go in the frame
CheckersSquare[ ][ ] board; / Will contain the
/ A square of the game Checkers
public class CheckersSquare extends Canvas cfw_
static public final int EMPTY= 0; / Constants used to indicate
static public final int RED= 1; / what is on a square.
static public final int BLACK= 2; /
/ OUR PROBLEM STATEMENT:
/ "scrape" webpages to get a stock quote for any specified ticker symbol.
/ (problem idea from Sedgewick and Wayne.)
/ This code will be posted to the course website.
/ Class In can be found at http:/www.cs.princeton.edu/introcs/s