A Retirement Calculator Applet

This applet is from the book Core Java by Cay Horstmann and Gary Cornell, published by SunSoft Press/Prentice-Hall

To figure out if you are saving enough for your retirement, enter the following:

The savings you have already accumulated and earmarked for retirement.
Annual contributions
The money you save every year for retirement, in constant dollars. When you save the money, you need to adjust that amount for inflation in future years. (For example, if you put in $9000 this year and anticipate inflation of 5% per year, you need to save $9,450 next year.)
Desired retirement income
This is the annual income, in today's dollars, that you want to have available at retirement from your investments. As a rule of thumb, it should be at least 75% of your current income. However, this calculator doesn't take into account social security income (which hopefully will still be around when you retire) or employer contributions, so if you expect income from those sources, reduce this figure accordingly.
Your current age
Your retirement age
Usually 65
The age you expect to reach
An estimate for the inflation rate
Historically about 5%
An estimate for the investment return
Historically up to 10% if you invest long-term in the stock market

Click the "Compute" button after entering all the values.

When you run this applet, the balance in your retirement account (in current dollars) is displayed in the graph and the scrolling table. The blue area of the graph is the pre-retirement saving phase. The green area is the post-retirement withdrawal phase until the account runs out of money, in which case it turns red.

When the red bars and the negative numbers appear, you don't have enough money. Make one or more adjustments and click "Compute" again. Some suggestions for adjustments:

Disclaimer: I am not an investment specialist. Don't rely on this applet for your retirement strategy!

The source for the applet.