Homework Assignment Three:

In this assignment you will be
practicing with `while`

and `for`

loops.

First, write an algorithm to settle the following question:

A bank account starts out withThis problem is listed as Exercise R1.16 (page 44) in your text.`$10,000`

. Interest is compounded at the end of every month at`6`

percent per year (`0.5`

percent per month). At the beginning of every month,`$500`

is withdrawn to meet college expenses after the interest has been credited. After how many years is the account depleted?

Now suppose the numbers (This extension is listed as Exercise R1.17 (page 44). This will be your assignment.`$10,000`

,`6`

percent,`$500`

) were user-selectable. Are there values for which the algorithm you developed would not terminate? If so, make sure it always terminates.

Therefore you are two write a program that asks the user for three values:

- initial balance (a
`double`

) - interest per year (another
`double`

, a percent value) - monthly expenses (another
`double`

, in dollars)

frilled.cs.indiana.edu%java Interests Welcome to the financial calculator. What's your initial balance? 10000 What's the yearly interest? 6 How much do you plan to withdraw monthly? 500 The account will last 1 year(s) and 9 month(s). Ending balance will be: 62.2 dollars. frilled.cs.indiana.edu%java Interests Welcome to the financial calculator. What's your initial balance? 10000 What's the yearly interest? 6 How much do you plan to withdraw monthly? 100 The account will last 11 year(s) and 6 month(s). Ending balance will be: 97.09 dollars. frilled.cs.indiana.edu%java Interests Welcome to the financial calculator. What's your initial balance? 10000 What's the yearly interest? 6 How much do you plan to withdraw monthly? 10 This will last forever. frilled.cs.indiana.edu%java Interests Welcome to the financial calculator. What's your initial balance? 10000 What's the yearly interest? 6 How much do you plan to withdraw monthly? 50 The account will last 525 year(s) and 1 month(s). Ending balance will be: 48.1 dollars. frilled.cs.indiana.edu%

Please
call your program (the class) `Interests`

for faster grading.