Java Reference
In-Depth Information
if (enterShipCB.getState()) {
EnterShipInfo esi = new EnterShipInfo();
} else {
EnterShipNum esn = new EnterShipNum(function);
}
So far the steps you have performed have defined “the plumbing” necessary for the classes to communicate
correctly. The next steps will add the CRUD methods to Shipment and change EnterShipInfo and EnterShipNum
to invoke the appropriate Shipment methods. We assume that the Shipment table was created in TNTDB with the
following SQL command:
CREATE TABLE tntdb.shipment
(empnum CHAR(10),
shipnum CHAR(10),
rcvmon CHAR(2),
rcvday CHAR(2),
rcvyear CHAR(4),
rcvhour CHAR(2),
rcvmin CHAR(2),
rcvampm CHAR(2),
supplier CHAR(20))
19.
Make Shipment a subclass of DBAccess.
20.
In the Shipment class, add the following private String variables along with getters and
setters for each:
rcvMon rcvDay rcvYear
rcvHour rcvMin rcvAMPM
21.
Copy the five doXxxx and three createXxxx methods from Tutorials.c10 Employee into
Shipment. We will edit these methods to fit Shipment instead of entering them in from
scratch. This will cut down on errors especially with the SQL commands.
22.
If needed, in the Shipment class, add the import statement for the SQL Exception class.
23.
In the appropriate Shipment class doXxxx methods, replace the references to the
employee table with shipment table. (Be careful: this step and the following seven steps
require specifying the correct field and table names, as well as, the correct data types,
button names, and text fields for the Shipment class and table.)
24.
In the Shipment class createXxxx methods, replace the references to the employee
properties with the shipment properties (i.e., the private variables).
25.
Copy the getEmpInfoFromRS and getEmpInfo methods from Employee into the
Shipment class.
26.
Change the Shipment class method names (copied in the step above) to getFieldsFromRS
and getShipInfo.
27.
Change the two new methods to use Ship information and the appropriate Shipment
methods not the Employee information and methods.
28.
Delete the catch for invalid value in getFieldsFromRS. (This was needed in Employee
because of numeric data but is not needed for the shipment information.)
Search WWH ::




Custom Search