September 2005
Beginner
576 pages
13h 6m
English
The next project you'll undertake has little practical value, except perhaps as a taunting device. The ShowWeight applet takes a person's weight and displays it under several different units. The applet takes two parameters: a weight in pounds, and the name of the person who weighs that amount. The weight is used to figure out the person's weight in ounces, kilograms, and metric tons, all of which are displayed.
Create a new file with your word processor and give it the name ShowWeight.java. Enter Listing 17.3 into the file. Then save and compile the file.
1: import java.awt.*; 2: 3: public class ShowWeight extends javax.swing.JApplet { 4: float lbs = (float)0; ... |
Read now
Unlock full access