Python Project 1-Financial calculators Solved

35.00 $

Category:

Description

Rate this product

Project 4.2 Financial calculators

In this project, you will write three calculators to help someone (maybe you) plan for your financial future.

Part 1: How long will it take to repay my college loans?

Your first calculator will compare the amount of time it takes to repay student loans with two different monthly payment amounts. Your main program will need to prompt for

• the student loan balance at the time repayment begins
• the nominal annual interest rate (the monthly rate times twelve) • two monthly payment amounts

Then write a function

   comparePayoffs(amount, rate, monthly1, monthly2)

that computes the number of months required to pay off the loan with each monthly payment amount. The interest on the loan balance should compound monthly at a rate of rate / 100 / 12. Your function should also plot the loan balances, with each payment amount, over time until both balances reach zero. Then it should print the length of both repayment periods and how much sooner the loan will be paid off if the higher monthly payment is chosen. For example, your output might look like this:

   Initial balance: 60000
   Nominal annual percentage rate: 5
   Monthly payment 1: 500
   Monthly payment 2: 750
   If you pay $500.00 per month, the repayment period will be 13 years
   and 11 months.
   If you pay $750.00 per month, the repayment period will be 8 years
   and 2 months.
   If you pay $250.00 more per month, you will repay the loan 5 years
   and 9 months earlier.

4.8 PROJECTS 􏰑 P4.2-1

Copyright Taylor and Francis, 2021

P4.2-2 􏰑 Discovering Computer Science, Second Edition

60000

50000

40000

30000

20000

10000

00 2 4 6 8 10 12 14 Years

$500.00 per month $750.00 per month

Question 4.2.1 How long would it take to pay off $20,000 in student loans with a 4% interest rate if you paid $100 per month? Approximately how much would you have to pay per month to pay off the loan in ten years?

Question 4.2.2 If you run your program to determine how long it would take to pay off the same loan if you paid only $50 per month, you should encounter a problem. What is it?

Part 2: How much will I have for retirement?

Your second calculator will compare the retirement nest eggs that result from making two different monthly investments in a retirement fund. Your program should prompt for the following inputs:

• the initial balance in the retirement account
• the current age of the investor
• the desired retirement age of the investor
• the expected nominal annual rate of return on the investment • two monthly investment amounts

Then write a function

   compareInvestments(balance, age, retireAge, rate, monthly1, monthly2)

that computes the final balance in the retirement account, for each monthly in- vestment, when the investor reaches his or her retirement age. The interest on the current balance should compound monthly at a rate of rate / 100 / 12. The function should plot the growth of the retirement account balance for both monthly investment amounts, and then print the two final balances along with the additional amount that results from the higher monthly investment. For example, your output might look like this:

Account balance ($)

Initial balance: 1000
Current age: 20
Retirement age: 70
Nominal annual percentage rate of return: 4.2
Monthly investment 1: 100
Monthly investment 2: 150
The final balance from investing $100.00 per month: $212030.11.
The final balance from investing $150.00 per month: $313977.02.
If you invest $50.00 more per month, you will have $101946.91 more at retirement.

4.8 PROJECTS 􏰑

P4.2-3

350000 300000 250000 200000 150000 100000

50000 0

20 25 30 35 40 45 50 55 60 65 70 Age

$100.00 per month $150.00 per month

Question 4.2.3 Suppose you are 30 and, after working for a few years, have managed to save $6,000 for retirement. If you continue to invest $200 per month, how much will you have when you retire at age 72 if your investment grows 3% per year? How much more will you have if you invest $50 more per month?

Part 3: How long will my retirement savings last?

Your third calculator will initially perform the same computation as your previous calculator, but with only one monthly investment amount. After it computes the final balance in the account, it will estimate how long that nest egg will last into retirement. Your program will need to prompt for the same values as above (but only one monthly investment amount), plus the percentage of the final balance the investor plans to withdraw in the first year after retirement. Then write a function

   retirement(amount, age, retireAge, rate, monthly, percentWithdraw)

that adds the monthly investment amount to the balance in the retirement account until the investor reaches his or her retirement age, and then, after retirement age, withdraws a monthly amount. In the first month after retirement, this amount should be one-twelth of percentWithdraw of the current balance. For every month thereafter, the withdrawal amount should increase according to the rate of inflation,

Account balance ($)

P4.2-4 􏰑 Discovering Computer Science, Second Edition

assumed to be 3% annually. Every month, the interest on the current balance should compound at a rate of rate / 100 / 12. The function should plot the retirement account balance over time, and then print the age at which the retirement funds run out. For example, your program output might look like this:

   Initial balance: 10000
   Current age: 20
   Retirement age: 70
   Annual percentage rate of return: 4.2
   Monthly investment: 100
   Annual withdrawal % at retirement: 4
   Your savings will last until you are 99 years and 10 months old.

300000

250000

200000

150000

100000

50000

0 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Age

Question 4.2.4 How long will your retirement savings last if you follow the plan outlined in Question 4.2 (investing $200 per month) and withdraw 4% at retirement?

Account balance ($)

  • Financial-Calculators-Python-main-rb5huv.zip