4.7. Example Program: Debt Calculator

While the checkerboard program is a hoot, it is not necessarily very useful. Let's write another program that is a bit more realistic, again with the aim of tying together many of the concepts we have learned thus far. The program we will write is a debt calculator. It will take a few variables, such as the amount of debt you've got, your income, and the interest rate, and the program will figure out how many years it will take you to pay it off. In so doing, it makes use of different variable types (including constants and typecasting), logical and mathematical operations and varying notation, conditional logic, and loops.

Here's a more specific overview. The purpose of the program is to calculate the number ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.