Chris Pollett >
Old Classes >
PIC20B

   ( Print View )

Enrollment info

Course Info: Homework Assignments: Practice Exams: PIC:
                            












HW#4 --- last modified January 16 2019 00:35:19..

Solution set.

Due date:  10:30pm May 24, 2001
=========

Files to be submitted: pic20bhw4file1.zip (should have both your
======================                     java source and database in it.
                                           Or your problem 20.8 files)

HW4 Purpose: To gain experience using JDBC. Or to gain experience with RMI
============

Specification:
==============
For this assignment you must either do the project below or
Deitel and Deitel problem 20.8. They are both of comparable length.
However, as of now you can't do the assignment below in the lab, but it
should be doable at home if you have Access. On the other hand we
won't cover till Wednesday the material in Chapter 20.

Point Breakdown for HW4 if do 20.8
=====================================
How well code commented.................1pt
PhoneBookServer Interface...............1pt
PhoneBookServerImpl addEntry works......1pt
PhoneBookServerImpl modifyEntry works...1pt
PhoneBookServerImpl deleteEntry works...1pt
PhoneBookEntry class is as described....1pt
PhoneBookClient can scroll through
 entries................................1pt
PhoneBookClient can modify
 entries................................1pt
PhoneBookClient can delete
 entries................................1pt
Reasonable error checking...............1pt

Total..................................10pts

If you don't do 20.8 then for this homework you
will write a Java program that allows
a data entry slave to write, update and search through
a database of Employee records. This database is very
simple it has only one table Employee with the following
fields:

First Name
Last Name
Social Security Number
Security Clearance
Seniority Step
Salary

The last two fields fields are integers, security clearance is an integer,
and the rest should be character strings. You should create a database
with this table in it in Microsoft Access. Then make an ODBC data source
for this table. You then need to write a Java application which has two
buttons at the top: Create, Update/Search. When Create is clicked a form
like the following appears in the area below the three buttons.

First Name: [       ]
Last Name: [       ]
SSN: [        ]
[Advanced] [Add to database]

If all three fields are filled out then clicking add to database creates
a new row in the employee table using the data given together with
0 for Security Clearance, 0 for Seniority Step and 8000 for salary.
Your program should check that all three fields have been filled and that
the ssn is a 9 digit number before adding the row. If not it should give a
warning. Clicking Advanced changes this form to a form which looks like

First Name: [       ]
Last Name: [       ]
SSN: [        ]
Security Clearance: [         ]
Seniority Step: [        ]
Salary: [         ]
[Normal] [Add to database]

Again, if one fills out all the fields with the correct types and
Salary >=0, 0<= Security Clearance <=5, and 0 <= Seniority Step <=10
then clicking Add to Database adds the row to the database. Clicking
Normal returns the user to the first form.

If the user clicks on [Update/Search] then a form like

First Name: [       ]
Last Name: [       ]
SSN: [        ]
Security Clearance: [         ]
Seniority Step: [        ]
Salary: [         ]
[Previous] [Update] [Next]

Filling out some fields and clicking on [Next] will cause a query on
the database given those field values to be executed. A result set matching
the query is then gotten and the first row of this result set is used to
fill in the values of the remaining fields. Clicking next again will
use the second row from the result set to fill in the fields, etc.
Clicking the previous button from allows one to back up through the
rows. Clicking previous back past the original query will return the last row
in the result set. If no fields were filled out before the first [Next]
or [Previous] click then one can imagine it is as if we
left off the where clause from our query and any row in the Employee
table will match. If after starting a query the user edits fields
and presses next or previous the program starts a new query based on matching
what the fields currently say. Finally, if the user edits some fields and
hits [Update], then if the editted fields match the conditions mentioned
earlier for valid field values, the old recorded in the database is updated
with the new one.


Point Breakdown for HW4 Project above
=====================================
How well code commented.................1pt
Database has been properly created......1pt
Clicking [Create] and
   [Update/Search] bring up the correct
               forms....................1pt
Advanced and Normal buttons works as
   described............................1pt
[Add to database] works and checks
  constraints before inserting..........1pt
[Add to database] fills in default
  values in normal mode but not in
  advanced mode.........................1pt
In [Update/Search] mode [Next] button
 works as described.....................1pt
In [Update/Search] mode [Previous]
 button works as described..............1pt
In [Update/Search] mode [Update]
 button works as described..............1pt
Exceptions handled and Statements are
 closed when done exceuting queries,
 etc...                                 1pt

Total..................................10pts