IS 313: Data Structures in Java
Autumn 2002
Individual Assignment 3
Graphical user interfaces and data base access
Due Wednesday November 6 before 11:30pm
For this assignment, you will create a program that has the same
functionality as the last assignment. This time, however, your
program will have a graphical user interface and will be implemented
by accessing a database. Your program should be organized in two
parts: the user interface and the database-accessing back end.
Part 1
The graphical user interface may be your own design, but we will also
discuss sensible designs in class. You are also free to discuss
design among classmates, even to the point of sharing the same design.
However, you must write your own code to implement the design.
Your graphical user interface must have the following properties:
- Table information must be displayed on a separate window using
the Table swing components.
- The interface must use at least two kinds of listeners. We will
discuss some sensible choices in class.
- The interface asks for confirmation before adding a new donation
to the donations table.
- The interface must minimize any logical operations on the
information it displays. Instead it should rely on the methods of the
class used in Part 2 for obtaining information.
- Implement your user interface in the file DonationViewer.java.
Part 2
For this part, you will implement a class called DonationAccess that
creates a database connection and retrieves information that will be
displayed in the user interface. The methods for this class will be
similar in name and function as those offered by the SavedDonations
and DonorCollection classes from the last assignment. However,
DonationAccess will consolidate the functionality of these two classes
into just one class.
The Funds database (or, if you are running
Access 97, the Access 97 version) provides
the tables containing the data. This demonstration program provides the SQL
statements that you will need for accessing the database. For
updating the database, the following statement adds the donation of
"10.00" for ID #123:
// this adds a new record to the database
stmt.executeUpdate("INSERT INTO Donations " +
"VALUES (123, '10.00')");
A skeleton of the DonationAccess
class is provided with some of the methods already implemented.
Alternate approach for Part 2
If you are more comfortable working with the ResultSet class from the
database, you may choose to have your database methods return
ResultSet objects. Your interface for Part 1 will then access the
ResultSet object in order to display the tables. This demonstration program provides the SQL
statements you will need for this approach. With this approach, you
can create a method for each of the queries in the demonstration
program.
A skeleton of the DonationAccess
class using the alternate approach is provided with some of the
methods already implemented.
Submission
Before the due date and time, you should submit the following files
through the submission
Web page:
- DonationViewer.java
- DonationAccess.java
If for some reason you are unable to submit the files, you may email me
them as an attachment.