Java Reference
In-Depth Information
Table 8-19
CODE
stock.setText("End of File");
volume.setText("");
price.setText("");
change.setText("");
11. Save the file. Compile the program. If errors occur, correct them in the
source code window, save the file, and then compile the program again.
12. Run the program. Click the Next button to look at all nine stocks. When you
are finished, click the Close button in the program's title bar.
13. Print a copy of the source code for your instructor.
14. For extra credit, redo the data file with current stock information from the
Web or newspaper.
10 Creating a Meteorology Data File
Your friend is majoring in meteorology. As a class project, she has been manually
recording the daily rainfall amounts from the last 30 days. She now would like to
generate an electronic data file to store the information. Create a Java application
with a for loop that runs from 1 to 30. Components should include an input
JTextField, a submit button, and appropriate prompts. Store the data file with the
name RainfallReadings.dat on the Data Disk or in another location specified by
your instructor.
11 On-Time Plumbers
On-Time Plumbers wants an interface with the Motif Look and Feel that allows
its dispatcher to enter and record service calls each day and store them in a data
file on a floppy disk. The fields should include time of the call, customer name,
address, telephone number, and a description of the problem. The program
should store the generated data file with the name Dispatch.dat on your Data
Disk. Enter seven sample customers and then open the data file with TextPad.
Print its contents, but do not resave the file.
12 Creating Message Boxes
Add a message box to any frame-based program that you created in this chapter
or the previous chapter. The message box should display when the user clicks the
Close button on the title bar. The message box should display the words, Are you
sure you want to quit?, in its message. Place the statement before the System.exit
command. Add functionality to both buttons. Save, compile, and execute your
program. Print a copy of the source code.
 
Search WWH ::




Custom Search