Java Reference
In-Depth Information
a) Select all authors from the
Authors
table.
b) Select a specific author and list all books for that author. Include each book's title, year
and ISBN. Order the information alphabetically by the author's last name then by first
name.
c) Select a specific title and list all authors for that title. Order the authors alphabetically
by last name then by first name.
d) Provide any other queries you feel are appropriate.
Display a
JComboBox
with appropriate names for each predefined query. Also allow users to supply
their own queries.
24.3
(Data-Manipulation Application for the
books
Database)
Define a data-manipulation ap-
plication for the
books
database. The user should be able to edit existing data and add new data to
the database (obeying referential and entity integrity constraints). Allow the user to edit the database
in the following ways:
a) Add a new author.
b) Edit the existing information for an author.
c) Add a new title for an author. (Remember that the topic must have an entry in the
Au-
thorISBN
table.).
d) Add a new entry in the
AuthorISBN
table to link authors with titles.
24.4
(Employee Database)
In Section 10.5, we introduced an employee-payroll hierarchy to cal-
culate each employee's payroll. In this exercise, we provide a database of employees that corresponds
to the employee-payroll hierarchy. (A SQL script to create the
employees
database is provided with
the examples for this chapter.) Write an application that allows the user to:
a) Add employees to the
employee
table.
b) Add payroll information to the appropriate table for each new employee. For example,
for a salaried employee add the payroll information to the
salariedEmployees
table.
Figure 24.33 is the entity-relationship diagram for the
employees
database.
24.5
(Employee Database Query Application)
Modify Exercise 24.4 to provide a
JComboBox
and
a
JTextArea
to allow the user to perform a query that is either selected from the
JComboBox
or de-
fined in the
JTextArea
. Sample predefined queries are:
a) Select all employees working in Department SALES.
b) Select hourly employees working over 30 hours.
c) Select all commission employees in descending order of the commission rate.
24.6
(Employee Database Data-Manipulation Application)
Modify Exercise 24.5 to perform
the following tasks:
a) Increase base salary by 10% for all base-plus-commission employees.
b) If the employee's birthday is in the current month, add a $100 bonus.
c) For all commission employees with gross sales over $10,000, add a $100 bonus.
24.7
(Address Book Modification: Update an Existing Entry)
Modify the program in Figs. 24.30-
24.32 to provide a
JButton
that allows the user to call a method named
updatePerson
in
PersonQue-
ries
class to update the current entry in the
AddressBook
database.
24.8
(Address Book Modification: Delete an Existing Entry)
Modify the program of Exercise 24.7
to provide a
JButton
that allows the user to call a method named
deletePerson
in
PersonQueries
class to delete the current entry in the
AddressBook
database.
24.9
(Optional Project: ATM Case Study with a Database)
Modify the optional ATM Case
Study (online Chapters 33-34) to use an actual database to store the account information. We pro-
vide a SQL script to create
BankDatabase
, which has a single table consisting of four columns—
AccountNumber
(an
int
),
PIN
(an
int
),
AvailableBalance
(a
double
) and
TotalBalance
(a
double
).