Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. Part B: For Loop Program
  2.  
  3. Write a program to compute the interest on a bank account. The program will have the following characteristics:
  4.  
  5. • The user will be prompted to input a single line of text containing the deposit amount ($), interest rate (%), and term (in months or years). All items must be separated by whitespace and the input should not be case sensitive. Interest must be compounded monthly. So, some sample (valid) inputs might be:
  6. o 10000.00 5 36 months
  7. o 5000.00 4.5 2 years
  8. o 45000.00 5.0 24 Months
  9. • If the user has made an input error, you need to inform them of the error and prompt them to re-enter the information. Primary error conditions are:
  10. o Term specified that is not “months” or “years”.
  11. o If values for interest rate or term time ≤ 0.
  12. • For this program, you must use the FOR loop construct to compute the interest.
  13. • You must make sure that interest is computed properly for monthly compounding. If you don’t know what “compound interest” is, Google it. One such site is here.
  14. • Once you have verified that the data is properly entered, compute and print out the interest payment on a month by month basis.
  15. • At the end of the program, print out the beginning balance, final balance, and the cumulative interest earned. Make sure to clearly label each output.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement