Problem 1: Retirement Calculator Simple Retirement Calculator: Growth of annual investment over time horizon Write a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem 1: Retirement Calculator Simple Retirement Calculator: Growth of annual investment over time horizon Write a program to ask the user to enter an initial investment, start_principal, in $, an annual savings contribution at the start of each year, annual savings, in $, an annual investment rate of return, interest_rate_pct, in %, and the number of years, years_to_invest, to save for. Use float type for start_principal, annual_savings, and interest_rate_pct, and int type for years_to_invest. Also ask the user to input the print_interval as an integer which will be used to format the years to show in an output table. So I am expecting to find, and will be looking in your program for these variable names: start principal, annual_savings, interest rate_pct, years_to_invest, and print_interval. If the user enters 10000, 5000, 7, 30, and 5, your prompts and inputs should look as follows: Start Invest : 10000 Contribution : 5000 Return : 7 Years : 30 Print Interval: 5 The program should calculate the total principal invested and save the result in a variable called total principal invested. The formula for doing this is: total principal invested = start principal + (annual_savings x years to invest) The program should then calculate and display the investment balance at the end of every print_interval years of the investment horizon and display the results in a nicely formatted table. See the output of the sample test run below. To calculate the starting investment balance for any given year, take the ending balance at the end of the previous year, add the annual savings amount, and multiply the total by (1+ interest rate in decimal). (Note for simplicity we assume that the annual savings occurs at the start of every year). For example, if the initial investment is $10,000, the annual savings is $5,000, and the annual return is 10% then the first 3 years of your calculations would look as follows: Year 0 1 2 3 Start Invest 10,000.00 16,500.00 23,650.00 31,515.00 Contribution 5,000.00 5,000.00 5,000.00 5,000.00 % Return 10.00 10.00 10.00 10.00 $ Return 1,500.00 2,150.00 2,865.00 3,651.50 End Investment 16,500.00 23,650.00 31,515.00 40,166.50 Use a for loop with range() to generate the annual end investment for each year of the scenario. Display the output as a formatted table and make the table more compact by printing year 0 and only every print interval years of output, as well as the final year. Do not use tabs to create your table. Use f-strings to format your output. At the end of your for loop you should have an end investme mber. Save it in a variable called end_investment that I can check. Calculate the the investment return and save in the variable investment_return. The formula for the investment return is: investment return = end investment - total principal invested Test your function by matching the expected output exactly for the given inputs. Check your spelling and spacing carefully. You can try the following test inputs (the instructor may run additional and/or different scenarios to test your code): Try:start_principal = 10000, annual_savings = 5000, interest_rate_pct= 7, years_to_invest = 32, print_interval = 10 Here is the expected output to match exactly: ***Your Scenario*** Start Invest : 10,000.00 Contribution : 5,000.00 Return : 7.00% Years : 32 Print Interval: 10 Total of initial investment plus annual savings = $170,000.00 Year 0 10 20 30 32 Start Invest 10,000.00 93,589.51 258,022.73 581,487.76 676,819.83 Contrib 5,000.00 5,000.00 5,000.00 5,000.00 5,000.00 The end investment is = $729,547.22 Investment Return = $559,547.22 % Ret 7.00 7.00 7.00 7.00 7.00 $ Ret 1,050.00 6,901.27 18,411.59 41,054.14 47,727.39 End Invest 16,050.00 105,490.78 281,434.32 627,541.90 729,547.22 NOTE: Make sure you have variables total principal_invested, end_investment, and investment_return in your program with the correct calculated result for the input scenario. I will be testing different scenarios and checking the content of these variables as well as start_principal, annual_savings, interest_rate_pct, years_to_invest, and print interval. Problem 1: Retirement Calculator Simple Retirement Calculator: Growth of annual investment over time horizon Write a program to ask the user to enter an initial investment, start_principal, in $, an annual savings contribution at the start of each year, annual savings, in $, an annual investment rate of return, interest_rate_pct, in %, and the number of years, years_to_invest, to save for. Use float type for start_principal, annual_savings, and interest_rate_pct, and int type for years_to_invest. Also ask the user to input the print_interval as an integer which will be used to format the years to show in an output table. So I am expecting to find, and will be looking in your program for these variable names: start principal, annual_savings, interest rate_pct, years_to_invest, and print_interval. If the user enters 10000, 5000, 7, 30, and 5, your prompts and inputs should look as follows: Start Invest : 10000 Contribution : 5000 Return : 7 Years : 30 Print Interval: 5 The program should calculate the total principal invested and save the result in a variable called total principal invested. The formula for doing this is: total principal invested = start principal + (annual_savings x years to invest) The program should then calculate and display the investment balance at the end of every print_interval years of the investment horizon and display the results in a nicely formatted table. See the output of the sample test run below. To calculate the starting investment balance for any given year, take the ending balance at the end of the previous year, add the annual savings amount, and multiply the total by (1+ interest rate in decimal). (Note for simplicity we assume that the annual savings occurs at the start of every year). For example, if the initial investment is $10,000, the annual savings is $5,000, and the annual return is 10% then the first 3 years of your calculations would look as follows: Year 0 1 2 3 Start Invest 10,000.00 16,500.00 23,650.00 31,515.00 Contribution 5,000.00 5,000.00 5,000.00 5,000.00 % Return 10.00 10.00 10.00 10.00 $ Return 1,500.00 2,150.00 2,865.00 3,651.50 End Investment 16,500.00 23,650.00 31,515.00 40,166.50 Use a for loop with range() to generate the annual end investment for each year of the scenario. Display the output as a formatted table and make the table more compact by printing year 0 and only every print interval years of output, as well as the final year. Do not use tabs to create your table. Use f-strings to format your output. At the end of your for loop you should have an end investme mber. Save it in a variable called end_investment that I can check. Calculate the the investment return and save in the variable investment_return. The formula for the investment return is: investment return = end investment - total principal invested Test your function by matching the expected output exactly for the given inputs. Check your spelling and spacing carefully. You can try the following test inputs (the instructor may run additional and/or different scenarios to test your code): Try:start_principal = 10000, annual_savings = 5000, interest_rate_pct= 7, years_to_invest = 32, print_interval = 10 Here is the expected output to match exactly: ***Your Scenario*** Start Invest : 10,000.00 Contribution : 5,000.00 Return : 7.00% Years : 32 Print Interval: 10 Total of initial investment plus annual savings = $170,000.00 Year 0 10 20 30 32 Start Invest 10,000.00 93,589.51 258,022.73 581,487.76 676,819.83 Contrib 5,000.00 5,000.00 5,000.00 5,000.00 5,000.00 The end investment is = $729,547.22 Investment Return = $559,547.22 % Ret 7.00 7.00 7.00 7.00 7.00 $ Ret 1,050.00 6,901.27 18,411.59 41,054.14 47,727.39 End Invest 16,050.00 105,490.78 281,434.32 627,541.90 729,547.22 NOTE: Make sure you have variables total principal_invested, end_investment, and investment_return in your program with the correct calculated result for the input scenario. I will be testing different scenarios and checking the content of these variables as well as start_principal, annual_savings, interest_rate_pct, years_to_invest, and print interval.
Expert Answer:
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
) Consider integer division of one two's-complement binary number by another. Programming languages may vary in the result when one argument is negative. What differing conventions might they be...
-
Where is the line in the sand the point where such behaviors are so destructive that you feel that the relationship needs to end?
-
This worksheet makes use of two tables of data. The first table, the Lukistan Balance of Payments data lists various components of the Balance of Payments as reported by government. Some of these...
-
What does this PID illustrate and explain the process of each loop of this PID, Explanation includes the feedback system, measurement Parameters, valves, setpoint/manipulated variable if any. 2)...
-
In problem 3-13, you were asked to prepare a statement of cash flows for New Zealand Dairy Company. Use the information given in the problem to compute the firms free cash flows and the financing...
-
Mark Hopper is planning the audit of the investments account for audit client Garden Supply Co. (GSC). GSC invests excess cash at the end of the summer sales season through an investment manager who...
-
1. The above image shows a thin lens of focal length 5m. (i) What is the kind of lens shown in the above figure? (ii) If a real inverted image is to be formed by this lens at a distance of 7m from...
-
Questions 4. What would be a reasonable estimate of total cost for January of Year 2? 5. With only a 5 percent risk of being wrong, would you accept without investigation a January of Year 2 actual...
-
Choose a topic below - one that they found particularly interesting. identify the concept, describe the concept, and explore examples of how the concept has been used in a real-world example in...
-
Given the recent movement in the forward premium for the SEK/EUR rate, Bjrk can expect that the hedge will experience higher: A. basis risk. B. roll yield. C. premia income. Rika Bjrk runs the...
-
Analyze the foreign-currency return for Portfolio B. Justify your choice. The fund manager of Portfolio B is evaluating an internally-managed 100% foreigncurrency hedged strategy. Kamala Gupta, a...
-
Describe two considerations for each type of component recommended to Grimmett for her manager selection process. Grimmett asks the adviser if any other preparatory steps should be taken before...
-
Calculate the contribution of foreign currency to the Bhatt accounts total return. Show your calculations. Darden meets with Bhatt and learns that Bhatt will be moving back to his home country of...
-
The Caribou Fund is most likely classified as a: A. large-cap value fund. B. small-cap value fund. C. small-cap growth fund. Three years ago, the Albright Investment Management Company (Albright)...
-
Assume the consumer basket consists of 400 kgs of apples and 300 kgs of mangoes. In the base year 2015 price of 1 kg of apples was 2.5/kg, and in 2016 - 2/kg. In 2016 price of 1 kg of mangoes was...
-
Don Griffin worked as an accountant at a local accounting firm for five years after graduating from university. Recently, he opened his own accounting practice, which he operates as a corporation....
-
Write a recursive method that returns the number of 1's in the binary representation of N. Use the fact that this is equal to the number of 1's in the representation of N/2, plus 1, if N is odd.
-
A file contains only colons, spaces, newlines, commas, and digits in the following frequency: colon (100), space (605), newline (100), comma (705), 0 (431), 1 (242), 2 (176), 3 (59), 4 (185), 5...
-
Suppose a binary tree has leaves l1, l2, . . . , lM at depths d1, d2, . . . , dM, respectively. Prove that Mi=1 2di 1 and determine when the equality is true.
-
The exhaust gases of a compression-ignition engine are to be used to drive an exhaust gas turbo-supercharger. Estimate the mean pressure ratio of expansion and the isentropic enthalpy drop per kmol...
-
(a) An amount of substance equal to 2 kmols of an ideal gas at temperature \(T\) and pressure \(p\) is contained in a compartment. In an adjacent compartment is an amount of substance equal to \(1...
-
The exhaust gas from a two-stroke cycle compression-ignition engine is exhausted at an elevated pressure into a large chamber. The gas from the chamber is subsequently expanded in a turbine. If the...
Study smarter with the SolutionInn App