CS 201 Home Page

The syllabus, lab exercises, and other information are posted here.  These are links to Word documents which you should be able to download and print.  Some Java source files are also given.  If you get TextPad successfully installed on your computer, when you click on the links to the Java files they should open in the editor.  You should then be able to save them locally and compile and run them.

cs201syl.doc  This is the syllabus for the course.

cs201download.doc  This is the information sheet on downloading and installing TextPad and Java

cs201labptrs.doc  This is the information sheet containing pointers on using the lab and doing assignments.

FirstProg.java  This is the program file referred to in the lab points sheet.  Note that it is also used in assignment 1.

ConsoleReader.java  This is the ConsoleReader.java program supplied by the book for doing program input from the keyboard through a DOS window.  Early in the semester you will want to make a copy of it under its correct name and plan on having a copy in the same directory with any program that does keyboard input.  It is helpful to put the following line at the top of any program file that makes use of it:  "import ConsoleReader;"

Java API documentation  This is a link to the Sun documentation page for Java.  All system supplied classes are documented here.  Before the semester is over with you will discover that you can find lots of helpful information here.  It is not easy to keep a lot of the details about Java classes in mind at all times.  Quite often when people ask specific questions in class you will hear me refer them to the API documentation since I don't know the answer off the top of my head, but I know that it is in here. 

    As time permits I will be trying to provide new versions of the assignments along with keys for them.  You can turn either the new or the old version of the assignments for credit.  The old version are shown farther below on this page.  If you are working ahead of where we are in class and a new version doesn't exist, feel free to do the old one.  Even if the new one does exist and you would prefer to do the old one, you are welcome to.  Finally, it is possible that during the course of the semester I will not complete writing all of the new versions.  This will be evident if we are covering a certain topic but the link to the new version does not yet connect to anything.  In that case you will have no choice but to do the old version of the assignment.  In addition to posting things here, I will announce in class what has been posted.  If it seems to you that I have forgotten to announce something, or if the situation at any particular time is not clear, please ask in class and I will explain what assignment we are on, what has been posted, and whether a new version exists or if you have to work the old version.



    Following are a few files illustrating the idea of the null reference, which comes up at the end of chapter 3.  These are not needed in order to do assignment 3.  They will be covered in class.  They are posted because they may be of interest and because a student suggested it.  Notice that they are posted as .java files instead of .txt files.  This makes them easier to use after downloading.  However, it also means that some people may not be able to download them.  If so, please let me know.



cs201test1key.doc  Here are the answers to test 1.

    Here is an example program for chapter 4.  This is one of the examples that will probably be shown in class.  You can use it as a starting point for your solution to question 2 on the assignment.




    Here is the last example program given in class on chapter 6.  It illustrates the use of the random number generator.



    Both cs201ass7new.doc and cs201ass8new.doc cover material from chapter 7 in the book.  Additional files on that material that should be helpful for assignment 8 are given after assignment 7 and before assignment 8. 


    What follows are the test program for some static methods using recursion; the class containing those methods, with comments explaining how to format comments to create Web documentation; and a link to the Web documentation showing what results from running the javadoc utility against this commented class.





    Since assignment 8 consists of classes and test programs to run them, not short answer questions or fragments of code, instead of a document containing the answers as a key, links are given here to complete solution files.  There is not a separate solution to problem 1, since it is also the basis for a correct solution to problem 2.  Also notice that the files for problem 3 have been given descriptive names rather than names based on the problem number.







    There are 3 assignments on chapter 9, assignments 9, 10, and 11.  Assignment 9 consists of some short answer questions.  Assignments 10 and 11 are programming problems.



  Here are some solutions to assignment 10.  The solutions are given after the completion of part 2.  Separate solutions are not given for part 1 alone.



  Here are some solution files for the class hierarchy and test program after completing part 1 of assignment 11.


  Here are some solution files for the class hierarchy and test program after completing part 1 of assignment 11.



  Assignment 12 covers chapter 11.  The last problem on the assignment consists of writing a static method and a test program.  Sample solutions for these are provided. 




  Assignment 13 covers chapter 13.  The assignment file is posted, along with an example program, a sample solution program, and a sample input text file.



Final Test Information:

Thursday, May 2nd, 10:00 a.m.-12:45 p.m.

    There are 5 short programming problems worth 20 points apiece, one on each of the following topics:  1)  The clone() method;  2)  The equals() method;  3)  One-dimensional array processing;  4)  2-dimensional array processing;  5)  File reading and writing where you don't have to be able to set up the try/catch/finally blocks, just do some specified reading and writing operations.

Lab assignment 1  chapter 1
Lab assignment 2  chapter 2

    Fall 2001:  the first test will cover chapters 1 and 2 only.  A sample test, a handout to go with it, and the key from a previous offering of this class are included below.  Do not be alarmed that it covers material that you're not familiar with.  In the previous offering of the class it was possible to get up through chapter 3 before the first test.  Not only will the test you receive cover a different subset of material--this sample is given without the promise that your test will have exactly the same kinds of questions.  It is merely representative of what it is possible.  In general, on a test in this class you might be asked to identify errors, show output from isolated fragments of code, write classes and programs, etc.  Your surest guide to the skills that the test is supposed to measure are the homework assignments for the chapters covered.

cs201extest1a.doc  Example test 1 handout
cs201extest1b.doc  Example test 1
cs201extest1key.doc  Example test 1 key

    You may or may not want to look at the things supplied below.  They are pretty much the solutions to one of the assigned problems which I provided because a student in a previous class requested them.  I don't mind showing things--you just have to discipline yourself to do the work first, and then compare later if you want to.  Simply copying work I've done usually doesn't help you learn anything.

Product.txt  By request, the product class needed for problem 3.8.
Chapter3problem8.txt  By request, the program for problem 3.8.

Lab assignment 3  chapter 3

rectangleapplet.txt  Here is the first example applet from chapter 4.

    There is no link to the UnitConverter class given by the author in chapter 4.  I am leaving this out in order to discourage you from wasting your time trying to use it.  As noted in the assignment, you don't need to use it to satisfy my requirements, and I don't recommend trying to use it.

Lab assignment 4  chapter 4

Lab assignment 5  chapter 5.  This is the old version of the assignment.  It is not recommended but is still posted for reference in case people have already started on it and plan on turning it in.  If you have done the new, improved version and have time on your hands, you might want to consider these problems.

Lab assignment 5 new  chapter 5.  This is the new, improved lab assignment 5.  I suggest that you do this one.  If you have already started on the other one and want to hand that in for credit, that's OK too.  Then use this one as a study tool.
Lab assignment 5 key  This document contains the solutions to the new, improved lab assignment 5.

amazeout.doc  The topic of writing clever code came up in class.  Here is an example in the C programming language.  No example is given in java because such an example would be a bad one to follow in doing assignments.  Amuse yourself in this was if you so desire.

NamedShape.txt  This is the class given as an example while covering chapter 6 foreshadowing the implementation of an equals() method in a class you have written the definition for--posted by request.
NamedShapeTest.txt  This the program that tests the NamedShape class given above--posted by request.

MonteCarlo.txt  This is the Monte Carlo simulation program for doing integration--posted by request.

Lab assignment 6  chapter 6

staticmethodstuff.txt  Here is the simple initial example of doing a static method (chapter 7), posted by request.
Test program for logarithm example (ch. 7)
Implementation of logarithm example (ch. 7)
Javadoc documentation of logarithm example (ch. 7)

Lab assignment 7  chapter 7

Lab7Part1Prog.txt  The program part of the solution to part 1 of the assignment, provided by request.
Lab7Part1Class.txt  The class part of the solution to part 1 of the assignment, provided by request.

chapter 8, no lab.  With the exception of a few remarks in class, we will not be covering this chapter.  You may ignore the following links in parentheses.  I'm leaving them in this Web page as a reminder to myself of some material related to this chapter.  (Test program to call findarcsin, Class containing the static method findarcsin)

  Before doing anything with the classes below, note this disclaimer:  The classes posted here are only partial solutions to the assignment problems.  You may want to refer to them if you are having trouble getting started on something, but be forewarned that the classes and methods are not complete solutions to any particular parts of either of the two assignments on Chapter 9.  They are provided as samples only.  It would be possible to work the assignment by modifying the given code.  It would also be possible to work the assignment by writing all of your own code from scratch.  The second alternative may be better, but in case you’re completely lost you still have the sample code as a point of reference.

Test program for final Employee class hierarchy
A version of the Employee class
A version of the Manager class
A version of the Executive class
A version of the HourlyEmp class

  There are two assignments for chapter 9.  They build on each other, but because together they would be too much work for only a single assignment's worth of points, they are broken into two.  Please hand in the work for the two assignments separately, even though there is a lot of duplication between them in the class hierarchy and this means killing additional trees.

Lab assignment 8  Chapter 9
Lab assignment 9  Chapter 9

mynewegg.txt, part 2 of assignment 10, for reference
mydraw.txt, part 3 of assignment 10, for reference

Lab assignment 10  chapter 10

Lab assignment 11  chapter 13

  Here is some final information about the class:


  Information on the final test:

16 questions at 6 points apiece, 4 points for your name, 100 points total.

6 questions:  writing the parts of a subclass
3 questions:  abstract classes
5 questions:  toString(), clone(), equals(), and other method classes
2 questions:  superclass and subclass references