ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 03 May 2017 My Price 11.00

Assignment 4 -- Retirement Planning, Part 1

a

Assignment 4 -- Retirement Planning, Part 1

Instructions:

 write the first part of a program that allows a customer to plan for retirement.

Note: This program has no user input

Write a "pure" Python function named 'calc_final_balance' that calculates the final balance in a retirement account after annual savings accrue for and earn interest for a number of years. This is a simulation problem similar to the Credit Card sample program, except it is to be written as a function definition (which means, among other things, that it uses parameters instead of user input). Here is the specification:

  • The function requires3 parameters: thestarting agefor saving, theamount saved each year, and thepercentage interest rate. This function may assume that the values have been previously validated -- no input validation is needed in this function.
  • Saving is assumed tostop at age 70.
  • The functionuses a loopto perform asimulationof retirement savings. The loop iterates one time for each year that savings occur. Each year, the account balance is increased by the amount saved each year, and then -- after this increase -- the account earns one year's interest.
  • The function shouldreturn the final balanceat age 70.

TEST the 'calcFinalBalance' function by adding statements in the 'main program' to print out the final balance for several test cases and confirm that it is correct. For example, these statements:

print('$' + format(calc_final_balance( 30, 3000, 6 ), '.2f'))
print('$' + format(calc_final_balance( 20, 2000, 5.5 ), '.2f'))

should write on the web page the results $492143.05 and $519518.88. Choose test cases that check the function thoroughly, and document your testing in comments.

Here is a simple test case you can more easily trace by hand: calc_final_balance( 65, 2000, 10 ) should return the value 13431.22.

Documentation & Style Specifications

  • Include a main comment block at the beginning of the file listing that has your name, date, class and section number, and a brief description (one or two lines) of the project.
  • Include a comment block before the function headerto describe a) what the function does and b) how the function's parameters are used.  Follow the style you see in the posted examples, and in particular the cube_root.py sample program, which demonstrates the difference between the comment block at the very beginning of a code file and the comment block located before a function header.
  • Includeblank lineswhere appropriate to make the program easier to read.
  • Use descriptivevariable names.
  • Include comments at the end of your program that describe at least 3 test cases and the results.

Answers

(11)
Status NEW Posted 03 May 2017 06:05 AM My Price 11.00

-----------

Not Rated(0)