Java Reference
In-Depth Information
Chapter Summary
In this chapter, you learned to create a console application to calculate body
mass index (BMI). In creating the application, you leaned how to declare vari-
ables and write assignment statements to store data with proper identifiers. You
also learned to create an instance of a BufferedReader to store, or buffer, the
input received from the InputStreamReader (ISR) and to use assignment
statements to assign the input data to variables. You learned how to use the
readLine() method to make the program pause and wait for user input. In addi-
tion, you learned how to code formulas with arithmetic operators, including the
use of two methods from the Math class, round() and pow(). You learned to
write code that uses variables and concatenation to produce output on the dis-
play. You learned to modify the console application to accept data from a dialog
box using a Java Swing component called JOptionPane and its associated meth-
ods. Finally, you learned how to convert the application to an interactive applet.
You learned to use ActionListener to handle events, as well as to use constructors
to add Labels, TextFields, and a Button component to the interface. You learned
to use the init() method to add components to the applet interface and to use
the paint() method to display an image in the Applet Viewer window. After you
created an HTML host document to display the applet and run it using the
Applet Viewer, you learned about file management and looked at the types of
files created by TextPad and the Java SDK.
Search WWH ::




Custom Search