Text: Carrano and Prichard, Data Abstraction and Problem
Solving with Java: Walls and Mirrors, Addison Wesley, 2001.
Verification of Program Correctness
Loop Invariant ExercisesAnswers
List Example FilesFramesExample
Temperature Conversion Example
Example that reads from a file into an array of objects.
Example that displays figures using a next button.
Assignment 4 Applet with second window
Sorting Methods Priority Queue - Heap
The final exam will be May 9, 12:50-2:30
Week | Date | Topic |
|
Jan 22, 24 | Introduction, Java review, Java
windows and frames
Chapter 1: Library design exercise |
|
Jan 29, 31 | Java review: Arrays of objects
and linked data structures, stacks
Stack implementation of methods Library design exercise |
|
Feb 5, 7 | Chapter 2: Recursion |
|
Feb 12, 14 | Chapter 3: Data abstraction, Inheritance
and polymorphism
Chapter 9: Algorithm efficiency, sorting |
|
Feb 19, 21 | Chapter 4: Linked lists |
|
Feb 26, 28 | Linked Lists
Prefix, infix, and postfix |
|
Mar 5, 7 | Chapter 5: More recursion
Chapter 7: Queues |
|
Mar 19, 21 | Queues, Chapter 10: Trees
Review |
|
Mar 26 | Midterm exam |
Apr 2 | Chapter 8: Classes
and objects
Chapter 9: Algorithm efficiency, sorting |
|
|
Apr 4, 9 | Sorting methods |
|
Apr 11, 16 | Chapter 11: Tables, priority queues, heapsort |
|
Apr 18, 23 | Chapter 12: Hashing |
|
Apr 25, May 2 | Huffman codes |
|
May 9 | Final Exam 12:50-2:30 |
Program grading:
Programs will be due on the date listed on the assignment.
Programs one week late will incur no penalty.
Programs two weeks late will lose 1/3.
Programs three weeks late will lose 2/3.
Programs four weeks late will receive zero points.
All programs must be handed in by May 2
Programs may be resubmitted once for several additional points.
Programs should be created and compiled using JDK 1.2 or higher.
Submit a disk with a compiled version of the program and a printout of
the Java code. Make sure that your disks and printouts are labeled
with your name and course number.
Grading:
The midterm and final will each be worth 1/3. All the programs together will count for the other third. There will be 7 or 8 programming assignments. Program grades will be posted on my web site when available. The table will be sorted by the last six digits of your social security number. Names and the first three digits will not be shown. Final letter grades will be displayed on the web site by the end of December, if not earlier.
Applications:
One class in an application should be a driver class. It should instantiate the other class or classes and call appropriate methods. Usually this class is quite small. Other classes should do all the work for the program. For example, a program that reads data from a file, processes it, and then prints out results should do all the file processing in one or more classes. Methods in the classes can then be called from the main driver class. The classes that do the work are usually grouped into packages that are imported into the driver class.
Packages:
Classes that share functionality should be grouped together in packages. The package statement must be the first executable statement in the file. One of the classes in the file must be a public class. There can be other classes in the same file, so long as they are used only be the public class. If a class is to be imported into another class, it should be made public and stored in a separate file. When package files are compiled, their .class files must appear in a subdirectory that has the name of the package.
Visibility qualifiers:
Most variables in a class will be private. They are then accessible
only by the class and its inner classes. If a variable or method
is to be used inside the surrounding package, it should be marked as protected.
Only those methods that are to be used in classes in other packages should
be public. Usually variables are not public, only protected or private.
Private variables often require get and set methods to retrieve them or
provide them with values. Constructors are also used to provide values
for variables. These are only used for initialization. Do not
omit the visibility modifier. If you do, the variable or method has
package visibility. If this is what you want, specify it using the
protected modifier.