PowerBuilder Tips, Tricks, and Techniques

Berndt Hamboeck

Subscribe to Berndt Hamboeck: eMailAlertsEmail Alerts
Get Berndt Hamboeck: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Java EE Journal

J2EE Journal: Article

Double Your Money, or the Rule of 72

A simple way to find out when your finances will double

Last month I described the beginnings of my PBStock application, which I'm currently developing, but I didn't mention why I started to write this application. I wrote it because I was forced to try to get more for my money. It took awhile for me to understand that. You may realize it already.

I'm an independent consultant primarily for Sybase PowerBuilder, ASE, EAServer, and J2EE. We've had profitable times and used to get a reasonable hourly rate for our work, but this changed dramatically a few years ago. The rates dropped, and the bank interest on my deposits went down faster than I was able to say "wealth." Likewise my expenses have gotten higher and higher (e.g., the rent for my apartment). Suffice it to say I'm not very amused when I have to fill up my car with gas these days. For these reasons, I realized that something had to happen with the money I've saved over the years. It must be possible to get more for your money than the 1.75% interest the bank offers (not really a good deal when inflation is as high as the interest rates). But how much do I want for my money? In this article I attempt to answer this question. Be forewarned that it might not be for the math-phobic. However, you can download a sample application written in PocketBuilder that implements all this for you (www.pocketpb.com).

The Compound Interest
The great thing about bank deposits is that over time you are usually able to get compound interest. That is, interest is computed on a savings or checking account and the interest is added to this particular account. Because it's added to the account, the interest itself also earns interest during the next period. This is what's meant by compound interest. The time interval between the occasions when interest is added to the account is called the compounding period, which is usually one year. The interest rate, together with the compounding period and the balance in the account, determines how much interest is added in each compounding period.

As an example let's imagine a bank account with $10,000 and a nominal annual rate of 6% per year. What would you expect to have after one year? We would compute it by multiplying $10,000 by 0.06. This gives us $600. To bring this into a formula we would write:

BALANCE = MonMan * (1 + PERCENT)

This is for one year, but what happens to an account with compounded interest and no withdrawals in subsequent years?

Compound Interest (Future Value)
Suppose we open an account that pays us a guaranteed interest rate, compounded annually for more than one year. We make no further contributions; we just leave the money where it is and let the compound interest work for us. To find a formula for future value, we'll write MonMan for the starting capital, and PERCENT for the rate of return expressed as a decimal (thus, if the interest rate is 5%, PERCENT equals 0.05).

Our balance will grow according to the following schedule:

Year Balance
Now MonMan
1 MonMan + PERCENT*MonMan
2 (MonMan + PERCENT*MonMan) +
PERCENT*(MonMan +
PERCENT*MonMan)

As you can see, this quickly starts to get complex, but we can simplify it by pulling out factors (1 + r) from each line. If we do that we'll see a simple pattern:

Year Balance
Now MonMan
1 MonMan * (1 + PERCENT)
2 MonMan * (1 + PERCENT)2

If we follow this pattern for years (YEARS), we get the general formula for the future value:

FUTUREVALUE = MonMan * (1 + PERCENT)YEARS

This is easy, but not what a typical person would do. Usually we would start with an initial amount, invest it at an annual compounded rate of return, and add equal contributions every year. We're going to assume that the balance of the account for any particular year includes the interest growth from last year, but does not yet include the new contribution.

We'll write ANNUAL for the annual contribution, and to keep things easier we'll use 1PERC for (1 + PERCENT). Now, let's start writing down the account balance for the first two years:

Year Balance
Now MonMan
1 (MonMan + ANNUAL) * 1PERC
2 ((MonMan + ANNUAL)* 1PERC + |
ANNUAL)*1PERC

In other words, to go from one year's balance to the next, add on the contribution ANNUAL and then multiply by 1PERC to get the final interest. If we multiply these terms out, we'll start to see a pattern:

Year Balance
Now MonMan
1 MonMan * 1PERC + ANNUAL *
1PERC
2 MonMan*1PERC *2 +
ANNUAL*(1PERC + 2*1PERC)

So for several years this function would look like:

Balance(YEARS) =
MonMan *(1 + PERCENT) YEARS + ANNUAL * [( (1 + PERCENT)YEARS +1 - (1 + PERCENT) )/PERCENT]

The full PocketBuilder implementation is shown in Listing 1.

Double Your Money
The "Rule of 72" is the rule of thumb that can help you compute when your money will double at a given interest rate. It's called the Rule of 72 because, for example, at 10% your money will double every 7.2 years. As we've seen, to use this simple rule just divide the annual interest into 72. If you get a constant rate of 6% on your investment, divide 72 by 6. Thus, your money will double in 12 years.

This also works in reverse. Let's say you know that you need to double your money in a certain number of years because you want to buy a new car. To afford it, your available money has to double in two years so you can buy your car. Divide 72 by 2 for a 36% rate of return on your bank account (which is difficult but still possible). Be forewarned, like any rule of thumb, this simple rule is only good for approximations. How does this really work? Let's look at the real numbers. We want to know how long it takes an independent dealer (you in this case) MonMan to double given either the interest rate in percentage per year (PERCENT) or the number of years (YEARS).

MonMan * (1 + PERCENT/100)YEARS = 2MonMan

Because we said we'll try the case of PERCENT equaling 10%, we're solving this:

MonMan * (1 + 10/100)YEARS = 2MonMan

We cancel the MonMans to get the following:

(1 + 10/100)YEARS = MonMan

And we fill in our value for MonMan:

(1 + 10/100)YEARS = 2 -> (1.1)YEARS = 2


More Stories By Berndt Hamboeck

Berndt Hamboeck is a senior consultant for BHITCON (www.bhitcon.net). He's a CSI, SCAPC8, EASAC, SCJP2, and started his Sybase development using PB5. You can reach him under admin@bhitcon.net.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.