on up back w3c Fifth International World Wide Web Conference

Mortgage Applet (5)

    void update()
    {   String balString = balField.getText();
        String intString = intField.getText();
        String nyrString = nyrField.getText();
        if (balString.trim().length() == 0)
            msgArea.setText("Principal amount missing");
        else if (intString.trim().length() == 0)
            msgArea.setText("Interest rate missing");
        else if (nyrString.trim().length() == 0)
            msgArea.setText("Number of years missing");
        else {
            double bal = new Double(balString).doubleValue();
            double intyr = new Double(intString).doubleValue() / 100.;
            short nyears = (short) new Integer(nyrString).intValue();


Java - An Introductory Language Tutorial (E.A.Johnson)