on up back w3c Fifth International World Wide Web Conference

First Java Application

// Java program to compute the current value if the $24 paid for
// Manhattan Island in 1624 had been deposited in the bank
// at a specified annual rate, compounded annually.
class Manhattan
{
    public static void main (String args [] ) {
        long amt = 2400;  // Express in cents
        int rate;
        short yr;
        if (args.length == 0)
            rate = 2;      // default rate is 2% if none specified
        else
            rate = Integer.parseInt(args[0]);
        for (yr = 1624; yr < 1996; yr++) {
            amt += amt * rate / 100;
        }
        System.out.println("The amount in the bank in " + yr
            + " would be $" + amt / 100 + "." + amt % 100);
    }
}


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