You are on page 1of 3

Computer Science 065 ReadMe:

Annuity Calculator
Ellerbusch Blake
Krajewski Clare
Hanna Lexi
McCoy Katherine
May 5 2020
Purpose of Project
With our project, we can figure out various different aspects of an annuity with various input
values. Our project is a simulation of a financial calculator complete with a user interface using
the graphics library. Calculations could include present value, future value, interest rates, interest
amount, duration, and payment amounts.
How to use code
The code was created with 5 different classes: Calculator, Annuity, Perpetuity, Arithmetic, and
Geometric. Each class feeds into the “main” command code. Starting with the Calculator code, it
creates the user interface for the calculator, through a series of screens to select what type of
annuity is wanted, what values are known, and what we want to find. The four other classes are
types of annuity our code is able to calculate. The entered values include present value, future
value, payment, interest rate, duration, when the first payment is, and change in payment of
arithmetic and geometric annuities.
The individual annuity classes have methods to calculate the chosen value with equations from
Kellison’s Theory of Interest book. Once the type of annuity is chosen, the program directs the
user to the entry screen for the created type. Once values are entered, one of two things could
appear: value you were looking for or an error message. There are different types of error
messages including “Values must be numbers”, “Values must be positive and non-zero”, or
“more values are needed to calculate ____”.
Outputs
The calculator can find a variety of values from any amount of information. It can find the
present value, future value, payment amount, interest rate, duration, change in payment, and the
total interest accumulated over time. It also displays a timeline of the user’s annuity. As the user
clicks, they can see the price (present value) of their investment grow through each increment of
time.
The Process
Though we originally wanted to calculate continuous annuities as well, integration is a necessary
part of continuous annuities. While we could have found code that figured integration, we
thought it would be easier to just not do continuous annuities.
As far as division of the work, we tried to meet as group often and split the required work
between the four of us. We met five times over zoom to work and came up with ideas for the
code. The creation of the main() code was implemented by Kate, the error messages were created
by Lexi, the documentation and design of the interface was by Blake, and the Calculator code
was created by Clare.
Examples
Here are some examples from our ACTS class to try out.

(regular annuity) Ashley deposits 50 into her credit union account at the end of the month. She will
continue making these deposits of 50 at the end of each month for a total of four years. The credit
union account pays 3.75% annual effective interest. Calculate how much the account is worth after
the last deposit. (1+i)^12 = 1.0375 i = .003072542 n = 12*4 = 48
interest: .003072542 duration: 48 payment: 50 immediate(payments are made at the end of
each period) answer (FV) = 2581.74

(regular annuity) Eric is saving for a new car. He wants to accumulate 14,000 in three years. He
deposits X into a mutual fund at the beginning of each month starting today and continuing for 3 years.
The mutual fund earns at a nominal rate of 8.72%, convertible monthly. Calculate X.
interest: .0872/12 = .0072666667 future value :14000 duration: 3*12 = 36 due(payments are
made at the beginning of each period) answer(PMT) = 339.176

(arithmetic) Tim is saving for retirement. Today is Tim’s 21st birthday. Tim will deposit 500 into a
savings account on his next birthday. The account credits interest at a nominal rate of 7%,
compounded quarterly. Tim will deposit 550 into the account on his 23rd birthday, 600 on his 24th
birthday and so on until he makes a last deposit on his 65th birthday. Calculate how much is in the
account just after the last deposit.
(1+(.07/4))^4 = (1+i) i = .071859031
interest: .071859031 duration: 44 payment: 500 payment change: 50
Answer(FV) = 305,306.868

(regular annuity) Paul borrowed 2500 from Seth. Paul will pay Seth 641.84 in one, two, three and four
months to pay off the loan. Calculate the annual effective interest rate Seth is charging Paul.
Present value: 2500 payment:641.84 duration:4 answer(IRR) = .0107

(geometric) John makes deposits monthly to his mutual fund, at the end of each month for the next 6
years. The first deposit is 100. Each deposit afterwards is 2% greater than the prior deposit. The
mutual fund earns a nominal interest rate of 8%, convertible monthly. Calculate how much will be in
John’s mutual fund at the end of the six years.
payment :100 percent increase: .02 interest: .08/12 = .0066666667 duration:6*12 = 72
answer(FV) = 19,107.29

(arithmetic) Sue buys an increasing annuity where she will receive 100 in one year, 200 in two years,
and so on for 10 years. i=.06. Calculate the price Sue pays.
Payment: 100 payment change: 100 interest: .06 duration: 10 answer(PV) = 3,696.24
(arithmetic) Tom deposits 500 into a savings account in one year, 520 in two years, 540 in three and so
on until a final deposit of 800. The account earns an annual effective interest rate of 2%. Calculate the
accumulated value just after the last deposit.
Payment:500 payment change: 20 interest: 0.02 duration:16 answer(FV) = 11,958.92788

(geometric) You buy an annuity that pays 100 in one year, increasing by 5% each year for a total of 18
payments. The price P is based on i=.08. Calculate P.
Payment:100 percent increase: .05 interest: .08 duration:18 answer(PV) = 1,325.819578

(perpetuity) Nicole buys a perpetuity for 126,035.50. It provides annual payments of 500 starting in
one year. Calculate the interest rate.
Present value: 126,035.5 payment:500 answer(IRR) = .003967

Issues
With large values of duration, the timeline is cluttered and hard to read. The arrow is also more cut off.

You might also like