Computing Interest Using A Console
Application and GUI
Written by Professor Zelikovitz
PART
1) of the assignment will compute interest using the console application, and
PART 2) will create a graphic user interface (GUI) for the same problem. We will learn about how to do a GUI during
prior to your having to do this problem.
1)
Write a program that helps investors
compute information about a given savings account.
a)
Given an initial balance, P,
an interest rate, r,
and the number of years that the money is invested, t,
compute the total value of the account if the interest is compounded
continuously.
The formula for this is:
|
|
You can approximate e
by declaring a constant double and setting it equal to
2.718281828459045
Have the main program prompt the
user to input the variables, and call a value-returning function computeTotal that returns the
final total value.
b)
There are four variables in the
equation above : total, P, r, and
t. Allow the user to
put in ANY of the three variables, and compute and output the fourth. For
example, the user might input a starting amount (P),
ending amount (total) and
years (t), and the program would output the
interest rate(r)
necessary to achieve that final amount.
One way of doing this (a very simple
way) would be to instruct the user to enter 0 (ZERO) for the variable that is
unknown. A more elegant approach would
use a menu to allow the user to choose which variable would be unknown. Feel free to be creative in your approach.
c)
EXTRA CREDIT (2 extra credit points): Allow the user to choose one of two
options: compounded continuously (as
above) or compounded monthly. ( total =
)