CS 109 Java Home Page

 

cs109javasyllabus.doc  This is the course syllabus

cs109javaunitoutline.doc  This is an outline of the contents of the units for the course posted below.


Here are some links for TextPad and Java:

http://java.sun.com/j2se/1.5.0/download.html  Source for Java software

http://www.textpad.com/download/index.html  Source for TextPad software

 


These are selected parts of Sun's documentation of Java:

Main Page for Java Documentation

Sun Java Tutorial

Java API Documentation  This is the link where the Java system supplied classes are documented.
 


            Important Note:  As of Spring of 2005, Java underwent a version change from 1.4.x to 1.5.0.  I have tried to make sure that all of the links on this page have been updated.

 

If you are using a version of Java earlier than version 1.5.0, you may need to use this version of MyTerminalIO:

MyTerminalIOOld.java

 

In the units below there are links to the class MyTerminalIO.  This is the new version which has been modified to work with Java 1.5.0.

 

Unit 1

unit1notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

FirstProg.java

Unit 1 does not have an assignment.

The questions below are not an assignment.

unit1questionsrandomized.doc

unit1questionanswers.doc


 

Unit 2

unit2notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

FirstProg.java

SecondProg.java

unit2assignment.doc

unit2oddanswers.doc

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit2key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit2questionsrandomized.doc

unit2questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 2 you can choose to link either program 3 or 7 to your home page.)

 


 

Unit 3

unit3notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

            TestInput1.java

            TestInput2.java

unit3assignment.doc

unit3oddanswers.doc

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit3key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit3questionsrandomized.doc

unit3questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 3 you have to link the program formed by questions 31-35 to your home page.)

 


Test 1 Review, units 1-3

 

cs109test1review.doc

cs109test1reviewkey.doc

 


 

 

Unit 4

unit4notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

Cup1.java

Cup2.java

Cup3.java

TestCup3.java

Shampoo.java

Test1.java

Test2.java

Test3.java

Test4.java

Test5.java

Test6.java

unit4assignment.doc

unit4oddanswers.doc

            Here are the classes and parts of programs given in assignment 4.

MyRectangleContainer.java  This is the class referred to in the assignment.

Assignment4RectangleProg.java  This is the program that is started in the assignment.

NamedPolygon.java  This is the class referred to in the assignment.

Assignment4PolygonProg.java  This is the program that is started in the assignment.

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit4key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit4questionsrandomized.doc

unit4questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 4 you can choose to link either the program formed by questions 1-8, the class formed by questions 12-20, or the program formed by questions 22-25 to your home page.)

 


 

Unit 5

unit5notes.doc

            MyTerminalIO.java

These are links to the applets in the notes:

LineApplet

RectangleApplet

MyCircles       

MyText

These are links to the code for the applets:

            LineApplet.java

            RectangleApplet.java

            MyCircles.java

            MyText.java

This is a link to the Java class containing the Web documentation comments:

Cup3Commented.java

Go here for links to the Java documentation generated for this class:

Cup3Commented/index.html

unit5assignment.doc

unit5oddanswers.doc

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit5key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit5questionsrandomized.doc

unit5questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 5 you have to do all 3 programs in the assignment.  A separate html file should be created for each.  The html files and compiled class files should be uploaded.  Each of the programs should appear as a separate link on your home page.)

 


 

Unit 6

unit6notes.doc

            MyTerminalIO.java

This is the class in the notes:

            Cup4.java

unit6assignment.doc

unit6oddanswers.doc

            Here is the program given in assignment 6.

Unit6AssignmentProg.java  This is the program from question 11 in the assignment.

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit6key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit6questionsrandomized.doc

unit6questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 6 you can choose to link either program 13 or 14 to your home page.)

 


 

Test 2 Review, units 4-6

cs109test2review.doc

cs109test2reviewkey.doc

 


 

Unit 7

unit7notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

            MonteCarlo.java

            NestedLoopEx1.java

            NestedLoopEx2.java

These are links to the applets in the notes:

            NestedLoopApplet

            MonteCarloApplet

ColorCubeApplet

These are links to the code for the applets:

            NestedLoopApplet.java

            MonteCarloApplet.java

            ColorCubeApplet.java

unit7assignment.doc

unit7oddanswers.doc

            Here are the programs and parts of programs given in assignment 7.

            Assignment7Prog1.java

            Assignment7Prog2.java

            Assignment7Prog3.java

            Assignment7Prog4.java

            Assignment7Prog5.java

            Assignment7Prog6.java

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit7key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit7questionsrandomized.doc

unit7questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 7 you can choose to link either program 6, 8, or 9 to your home page.)

 


 

Unit 8

unit8notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

            CupX.java

            TestCupX.java

            MyMethodContainer.java

            TestContainer.java

            Cup5.java

            Cup6.java

unit8assignment.doc

unit8oddanswers.doc

            Here is the start of the program and class given in assignment 8.

            Assignment8Q6Prog.java

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit8key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit8questionsrandomized.doc

unit8questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 8 you have to link program 9 to your home page.)

 


 

Unit 9

unit9notes.doc

            MyTerminalIO.java

These are links to the example classes, programs, and applets in the notes:

            MyMethodContainer1.java

            MyMethodContainer2.java

Seed7.java

Cup7.java

TestCup7AndSeed7.java

Seed8.java

Cup8.java

unit9/TestCup8AndSeed8.java

This is the link to the applet:

TestCup8AndSeed8

unit9assignment.doc  You do not have to do the last two questions, 8 and 9, unless they are specifically brought up in class and discussed.

unit9oddanswers.doc

            Thing.java  This is the class given in question 6.

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit9key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit9questionsrandomized.doc

unit9questionanswers.doc

(This note is for my own reference.  It does not apply to CS 109:  For unit 8 you have to link program 9 to your home page.)

 


 

Test 3 Review, units 6-9

cs109test3review.doc

cs109test3reviewkey.doc

 


 

Unit 10

unit10notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

            UnicodeChars.java

            CharToInt.java

            WriteAlphabet.java

            ReadFile.java

            WriteStrings.java

unit10assignment.doc

unit10oddanswers.doc

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit10key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit10questionsrandomized.doc

unit10questionanswers.doc

 


 

Unit 11

unit11notes.doc

            MyTerminalIO.java

These are links to the example programs in the notes:

            TestPool.java

            PoolClass.java

            TestRecAndLoop.java

            RecursionAndLooping.java

This a link to the applet shown in the notes:

            PoolApplet

These is a link to the code for the applet.  Please note that this is given for completeness only, in case you're curious.  Although the applet animates recursion, it is implemented using loops.  The code does not show how to implement recursion.

            PoolApplet.java

unit11assignment.doc

unit11oddanswers.doc

            Here are the programs and parts of programs given in assignment 11:

            Assignment11Q1Prog.java

            Assignment11Q1Class.java

            Assignment11Q2.Prog.java

            Assignment11Q2Class.java

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit11key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit11questionsrandomized.doc

unit11questionanswers.doc

 


 

Unit 12

unit12notes.doc

            MyTerminalIO.java

            These are links to the example classes in the notes:

            FoodV1.java

            TaxedFoodV1.java

            FoodV2.java

            TaxedFoodV2.java

            FoodV3.java

            TaxedFoodV3.java

unit12assignment.doc

unit12oddanswers.doc

 

The following additional stuff isn't part of CS109.  Please disregard it.

unit12key.doc  Students don't have access to all of the answers.

The questions below are not part of the assignment.

unit12questionsrandomized.doc

unit12questionanswers.doc

 


 

Test 4 Review, units 10-12

cs109test4review.doc

cs109test4reviewkey.doc

 


 

magicalmysterytour.doc

 


CS 109 does not go beyond Unit 12.  The units below are not part of CS 109.

 


 

Unit 13

unit13notes.doc

            MyTerminalIO.java

            These are links to the examples in the notes:

            Food.java

            PackagedFood.java

            BulkFood.java

            Taxable.java

            TaxedPackagedFood.java

unit13assignment.doc

unit13key.doc

The questions below are not part of the assignment.

unit13questionsrandomized.doc

unit13questionanswers.doc

 


 

Unit 14

unit14notes.doc

            MyTerminalIO.java

            This is a link to the example in the notes:

            ShippingBox.java

unit14assignment.doc

unit14key.doc

The questions below are not part of the assignment.

unit14questionsrandomized.doc

unit14questionanswers.doc

 


 

Unit 15

unit15notes.doc

            MyTerminalIO.java           

unit15assignment.doc  You will notice that a key is not provided with this assignment.  This is a programming project rather than a simple programming assignment.  Lots of example code is given which can be used as a guide, but this example code is not a complete solution to the problem given.  It is up to you to come up with a complete implementation of this project.

 

            Here are the links to the example code for this unit, along with some commentary which more or less echoes the information given in section three of the unit notes:

            WariV1.java  This is the version of Wari that is done in a single program file.  This and all following examples based on Wari implement a simplified set of game rules.

            WariV21.java:  In this implementation the game board and the cups have been broken out into separate classes.  The board class implementation is a hybrid.  In the previous version of the program an array of cups formed the board.  In this implementation the cups of the board are still contained in an array.  However, these cups have links so that they can be traversed by following the links rather than by incrementing the array indexes.  It would be possible to to implement this without the array.  This example shows the reality of how one implementation can be the basis of another.  It does not hide the fact that such a development process may leave traces in the resulting code.

            WariV21.java

            BoardV21.java

            CupV21.java

            WariV22.java:  There is a difference between the cups on the board where play progresses and the cups where players' winnings are stored.  The cups where play progresses are linked to each other.  The winnings cups do not need to be linked to anything else.  In this implementation there is a plain cup class, and the winnings cups are instances of this class.  There is also a linked cup class, which is a subclass of the plain cup class.  The cups where play progresses are instances of the linked cup class.  As seen from version 21, it is not necessary to do this in order to have a correct implementation.  Version 22 is simply intended to provide a concrete illustration of a small inheritance hierarchy.

            WariV22.java

            BoardV22.java

            CupV22.java

            LinkedCupV22.java