CS 230 Spring 2005 Assignment
5 –Looping 100 points
Assigned: 02/21/2005
Due: 02/28/2005 at the start of class
Pre-Lab (Do Before Lab): Bring a new disk. Plan out
tasks, objects, and events needed for program. Plan out major pseudocode
Main Assignment:
Back
when IRA (Individual Retirement Accounts) were invented, banks advertised them
with the slogan “Retire Rich.” Let’s do some basic prediction of how much our
money will grow while we are investing in an IRA account (ignoring tax
consequences for simplicity). Write a program that, given an amount of money
the investor will deposit each month, an expected rate of return on investment
(annual percent), and the number of months until retirement, calculates the amount
of money the investor will have at retirement. Get from the user the amount of
the monthly deposit, the expected annual return on investment, and the number
of months. Display monthly balance for each month in a list box (see below).
Display the balance at retirement in a label or text box (locked of course).
Provide
capabilities to calculate, clear the input and output to start again, and to
exit.
Hand in:
- Floppy disk with an entire folder containing all files
related to the project. Please set the name of the project to
something other than the default name (WindowsApplication1, …)
- Print out of your code.
Miscellaneous:
- The expected annual rate of return on investment should be entered
as a percent (no percent symbol though).
- The expected return rate is annual, but in doing your monthly
calculations, you don’t get a full year’s worth of earnings in a month!
Assume months are equal length and investment return is always the
expected rate to keep this simple. If any questions, please ask!!! Your
calculations need to meet the requirements of the task.
- To add items to the list box, use lstboxname.Items.Add( a string ).
You can build a string out of pieces using “concatenation” . E.g. “Month:
“ & monNum.toString(“ ”) & …
- To clear the contents of a list box, use lstboxname.Items.Clear()
- Note that we have now covered specifying how many decimal places to
display – display a number appropriate for the results, with currency
symbols where appropriate.
- We’re no longer going to assume that the clerk enters valid and
reasonable values, so ensure that values entered are numbers and that they
are in acceptable range. Let’s assume that monthly contribution should be
positive and no more than $400.00, return rate needs to be between 1.0 and
15.0, and number of months needs to be from 1 to 600.
- You must turn on Option Explicit and Option Strict.
- MAKE SURE YOUR PROGRAM WORKS! (i.e. gets the correct answers). Now
that our program is branching and looping, we need to try more examples to
make sure they work. Think, “what different possibilities need to be
checked?” For each, calculate the correct answer by hand and see if
your program gets it!
- Make sure you save your work before running your program. It is
possible that an “infinite loop” could have to be terminated. Usually that
will be ok, but if you ever had to kill VB using the task manager you
could lose unsaved work.
- Put YOUR NAME, e-mail address, date and purpose in comments at the
beginning of the program.
- You MUST include comments that explain your program in order to get
full credit.
- Remember to use meaningful variable names, and indent to show the
structure of the program (VB usually does this correctly).
- Put your name on the form as a Label or as part of the form title.
- Try to use good user interface design.