What's New
- Final Exam and Semester Grades are posted in WebCT.
Miscellaneous Information:
Assignments:
- Practice Problem 1: Name Output due Thursday, 1/24
Solution available here
- Practice Problem 2: Retirement Planning Applet due on Thursday, 1/31
Solution available here
- Practice Problem 3: Time class due Monday, 2/11
Solution available here
- Practice Problem 4: Name List Applet due Thursday, 2/21
Solution available here
- Programming Lab 1: Tic Tac Toe due Thursday 2/28
Solutions available here:Regular Credit, 5% Extra
Credit and 10% Extra Credit versions.
- Programming Lab 2: Shape Hierarchy due Thursday 3/6
Solution available here
- Practice Problem 5: Abstract Shape due Thursday, 3/20
Solution available here: Shape.java (includes all shape definitions)
and ShapeTest.java
- Programming Lab 3: Shape Program due Thursday, 4/3
Solution available here ShapeProgram.java and Shape.java (defines Shape and its sub-classes)
- Programming Lab 4: Graphical Shape Applet due Thursday, 4/10
Solutions available here: GraphicalSquare.java and
ShapeApplet.java. Here's a
past student's extra-credit solution.
- Programming Lab 5: Robust Array Program due Thursday, 4/24
Solution available here: Robust Array Applet and
Robust Array Program
- Programming Lab 6: File I/O with Exception Handling due Thursday, 5/1
Solutions available here: Lab6.java. Here's a past student's extra-credit solution.
- Practice Problem 6: Vector in Graphical Shape Applet due Thursday, 5/8
Solution available here: ShapeApplet.java and
ShapeCanvas.java
Class Notes:
Sample Programs:
- Prerequisite Example: BlackJack Program in C++ or
BlackJack Program in Java
- an example of what I assume you already understand (Most of this is the same in C++ and Java)
Chapters 1-3: I/O, Applets, and review from last semester
- Echo.java: Shows Console I/O using Scanner and System.out
- InvestApplet.java: an applet that uses JOptionPane for pop-up
dialogs and DecimalFormat to format numbers.
- StringDemo.java - demonstrates some string manipulation
Chapters 3-5 and Section 6.3: Object-Based Programming
- SimpleCourseTest.java - a simpler and inferior version of
the following program:
- CourseTest.java - a file which
defines two classes - the Course class and the CourseTest class with a main method to test it.
- Bubble.java - a simple demonstration of static vs. instance variables
- Person class using a static member variable and a static member function:Person.java - a class to store employee info, and PersonTest.java - a test program for it.
Event-Driven Programming, Overloading, and Recursion (Chapters 3 - 6 Graphics Track Sections)
- storyApplet.java: a simple example of applet layout. It's
visible in the notes for: Methods and Related Topics (Chapter 6)
- liveStoryApplet.java: an example of an applet with 2 working
buttons (event-driven) It's visible in the notes for: Methods and
Related Topics (Chapter 6)
- recursivePrint.java - Simple recursion example to print a string
- recursiveFac.java - Simple recursion example to calculate
factorial
Chapter 7: Arrays
- BasicArray.java - Inputs and averages an array
of doubles.
- ArrayParam.java - Demonstrates how array parameters work
- ReturnArray.java - shows how to create an array in a function and
return it
- ArrayExp.java - Inputs and sorts an array of ints.
- Pixels.java - Models screen pixels with a 2-D array.
- Here's a program to demonstrate a jagged array (rows of different lengths in a 2-D aray)
Chapter 8: Inheritance Basics
- Person - a class representing a person and
its subclass:
Employee - a class representing an employee and its
subclass: SalariedEmployee - a class representing
an employee who is on salary
Chapter 9: Polymorphism
- polyDemo - a program demonstrating Polymorphism using
the above 3 classes together in one array.
- Animal.java defines an abstract class and
3 subclasses of it and AnimalDemo.java tests these classes.
- Talker.java defines an interface and classes which
implement it (plus 2 that don't) and TalkerDemo.java tests the
Talker classes.
Chapters 4 - 8 Graphics Track Sections: Stand-alone GUI Applications, Nested Classes, and Graphics
- LiveStory.java - a stand-alone application version of the
liveStoryApplet we had looked at before. It also defines an inner class that implements WindowListener.
Here are several different versions of the LiveStory program. They all do the same thing, with different
event handling structures:
- The following applet uses graphics in a Canvas and GUI objects. Its source code
is broken into two classes: GraphicCanvas.java and GraphicApplet.java. It can be viewed in
Graphics Notes (Chapter 7 Graphics Track)
- Here's a variation of that GraphicApplet program, changed to be a stand-alone program using JFrame,
and with one of the buttons working to change the size of a shape:
GraphicFrame.java and GraphicCanvas.java
Chapter 10: Exceptions
- RobustInvestApplet.java: a version of the
InvestApplet that handles non-numeric user input.
- RobustTime.java and
RobustTimeTest.java: a variation of the solution to Practice Problem 3, which defines an exception
class, throws, and catches it.
File I/O and Non-Scanner Keyboard I/O
- JunkMail.java: demonstrates file and keyboard i/o, but doesn't handle
any exceptions
- RobustJunkMail.java: same program as above, but it handles all
exceptions.
Network I/O, Vectors, Linked Lists, and GUI List Components - parts of Chapter 12 and Section 5.6
- ListStoryApplet - uses a List and a Vector
- ListStoryAppletUpdated - Version of above using typed Vector
- MagazineRack.java - Linked list example program from the textbook (Listings 12.1 - 12.3)
Modified to sort the magazines as it inserts them into the list
Last updated: 5/23 2:20pm