Java Reference
In-Depth Information
REQUEST FOR NEW APPLICATION
Date submitted:
December 10, 2007
Submitted by:
Mark Dunit, analyst
Purpose:
An application is needed to provide database access for a stock-tracking
application under construction for client, MoneyMark Trading. The GUI
application allows users to track their own customized account list of stock
holdings. As the GUI will change over time, a program must be available that will
provide database access independent of the GUI.
StockTrackerDB, MakeDB (one-time utility)
Application title:
Algorithms:
The password must conform to the recently developed Password class.
Notes:
1.
Programs using this data access program must handle all user interfaces,
accessing the database only through this program. A Microsoft Access
database will be used.
2.
User data consists of an ID, first name, last name, password, and an indicator
for an administrative or non-administrative user. User IDs must be unique and
used to access user data. Given a User object, the program can add, update, or
delete the user data in the database. Given a user ID, the program can return
the User object. The program can return from the database a list of all user
IDs, the first and last names of each, and whether or not each is an
administrator.
3.
For each stock, one stock symbol and one corresponding description exists.
The description is the name of the stock. The symbol is the unique access to
stock data. The program can add a stock given a symbol and a description.
The program can delete a stock for an existing stock symbol. The program
can provide a stock description (name) given an existing stock symbol.
4.
The program maintains the relationship between users and stocks. One user
can have zero to many stocks, and one stock can have one to many users.
Stocks held by at least one user are retained in the database. If a stock is
removed from a user's holdings and no other user holds that stock, the stock
and its description are removed from the database. If a user is deleted from the
system, all stock holdings for the user must be deleted. Users cannot delete a
stock, only their stock holdings.
5. Given a user ID, the program can provide a list of stocks held by the user. The
program can add or delete a stock holding given a user ID and stock symbol.
6.
A utility program should create the database structure and one administrative
user entry in the database. This user entry will be used for the initial user log
on so that additional users may be added by the application. Subsequent
executions should restore the database to its initial state.
Approval Status:
X
Approved
Rejected
Approved by:
Wilson Davis, Director of IT, AccessFour Software
Date:
December 11, 2007
Assigned to:
M. Mick, Programmer
FIGURE 11-2
DESIGN THE SOLUTION Once you have analyzed the problem and
understand the needs, the next step is to design the user interface and required
classes. To develop the GUI application for this chapter requires some new
classes and an interface, as well as modifications to existing classes. A few exist-
ing classes are used without changes. Because most of the GUI application uses
techniques already presented, and it uses another class to access the database, the
source code for all of the GUI components is provided on the Data Disk.
The application requires that only validated users have access; therefore,
before the application can be used, a database must be in place and have at least
one valid user. This is accomplished by a utility program, MakeDB.java, which
creates the structure and initial data for the database, as indicated by the
requirements document. The MakeDB.java program executes only once, when the
 
Search WWH ::




Custom Search