Java Reference
In-Depth Information
6 Validity Checks
Update the BillPayer program created in this chapter to include validity checks
on several fields before writing them to the external file. Check the account
number field for a length of 10. Check the payment amount field to verify that it
will parse to a double, thereby confirming it is numeric. Check the state field for
a length of 2, and parse the zip code to an integer. Provide appropriate error
message boxes and return the user to the field in question if the data is not valid.
You may continue to use the writeUTF() methods, even though some of the data
will be numeric.
7 Reading Data from the Payment File
The program developed in Chapter 8 sent data to an external, sequential data
file named payment11192007 (or payment plus the system date for your
computer). It opened a connection to the DataOutputStream and used the
writeUTF() methods to transfer data to the disk. Write a new program named
PaymentReader to read the data into a Swing interface that displays each record.
Include a Next button.
8 Entering Course Substitutions
The registrar at your school would like an interface to enter course information
for transfer students. The created data file should be sequential in nature, with the
student's name, his/her ID number, the course number from the previous college,
and the accepted course number at your school. The registrar then will give the
data file to the transcript officer who will update the student's permanent files.
Figure 8-38 displays the interface.
FIGURE 8-38
Search WWH ::




Custom Search