Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer to plan for retirement . Part 2: Generate a

-----------Python program-------------------

Instructions: For this assignment, you will write complete a program that allows a customer to plan for retirement.

Part 2: Generate a Retirement Planning Table:

It's hard to decide how much you need to save for retirement. To help your customer visualize how long her nest egg will last, write a program that allows the user to generate a retirement planning table showing the number of months the savings will last for various combinations of starting account balance and interest rate.

Here is one important goal of this assignment: You must use ("call") the 'calc_months' function you wrote for Assignment #4 in this assignment. This means that you need to put a copy of that function definition at the beginning of your code for this assignment. If your function gave correct results in Assignment #4, do not change it for this assignment. Instead, just write code that calls the calc_months function and show the value returned in the table.

Specification:

  • Get just one input value from the user: the amount to be spent each month. Make sure that the user has entered a number greater than or equal to $500.
  • Produce a table that shows the number of months savings will last in 40 different situations:
    • 10 different starting balances should be used: 450000, 500000, ... , 900000.
    • For each starting balance, vary the interest rate from 3% to 9% in steps of 2%.
    • Your program must use nested loops to produce the table.
  • Here is what the table would look like if the user specifies monthly spending of $5,000 (program output in blue, user input in black -- just the number 5000):

image text in transcribed

Development Tips:

  1. To get full credit, you must use nested loops to create the table.
    • The header of the table is created as part of the initialization for the outer loop.
    • Each row that follows is created by one pass through the outer loop.
    • In each row, the first cell is created as part of the initialization for the inner loop. The remaining cells are created by the body of the inner loop.
  2. To get full credit, the program must call the function written in Assignment #4.
  3. This Multiplication Table Sample Program is a valuable reference for this assignment.
  4. Don't forget to include comments showing documented test cases at the end of your program.

Assignment#4

def calc_months(initial_bal, interest, monthly_cost): months = 0

while initial_bal > 0 and months

def main(): print(calc_months(300000, 6, 3000)) print(calc_months(10000, 0, 2000)) print(calc_months(1000000, 4.5, 4200)) print(format(calc_months(1000000, 4.6, 4200), '.2f'))

main()

Welcome to the retirement planning tool! Enter monthly spending (at least $500): $5000 Retirement Savings Table: Starting Balance Assumed Interest Rate 335 % 7% 93 -- -- 102 115 113 129 150 175 $450000 $500000 $550000 $ 600000 $650000 $700000 $750000 $800000 $850000 $ 900000 O O ONO OOO 172 NN CON CD 000 WNNNN 600 600 600 600 600 NN W NO 600 600 o 31

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

What is the purpose of a causal loop diagram?

Answered: 1 week ago