3.   Object-Oriented Programming


In object-oriented programming, we write Java code to create new data types, specifying the values and operations to manipulate those values. The idea originates from modeling (in software) real-world entities such as electrons, people, buildings, or solar systems and extends readily to modeling abstract entities such as bits, numbers, programs or operating systems.

Java programs in this chapter.

Below is a list of Java programs in this chapter. Click on the program name to access the Java code; click on the reference number for a brief description; read the textbook for a full discussion.

3.1.1 PotentialGene.java identifying a potential gene
3.1.2 AlbersSquares.java Albers squares
3.1.3 Luminance.java luminance library
3.1.4 Grayscale.java converting color to grayscale
3.1.5 Scale.java image scaling
3.1.6 Fade.java fade effect
3.1.7 Cat.java concatenating files
3.1.8 StockQuote.java screen scraping for stock quotes
3.1.9 Split.java splitting a file
3.2.1 Charge.java charged-particle data type
3.2.2 Stopwatch.java stopwatch data type
3.2.3 Histogram.java histogram data type
3.2.4 Turtle.java turtle graphics data type
3.2.5 Spiral.java spira mirabilis
3.2.6 Complex.java complex number data type
3.2.7 Mandelbrot.java Mandelbrot set
3.2.8 StockAccount.java stock account data type
3.3.1 Complex.java complex number data type (revisited)
3.3.2 Counter.java counter data type
3.3.3 Vector.java spatial vector data type
3.3.4 Sketch.java document sketch data type
3.3.5 CompareDocuments.java similarity detection
3.4.1 Body.java gravitational body data type
3.4.2 Universe.java n-body simulation