Question: please complete the lab9_2.cpp . follow the instructions given on exercise 2. there is also testing case and hints provided. please write the code in

 please complete the lab9_2.cpp . follow the instructions given on exercise

2. there is also testing case and hints provided. please write the

code in c++. and please follow the pattern or style provided on

lab9_2.cpp. thank you New Tab e.com/drive/u/1 /folders/1ukCF7pL3UVOOR8JwEkulNxInLXAxftwbl Exercise 2: 401K Investments Download

lab9_2.cpp. Attach the completed cpp file to your submission This exercise will

please complete the lab9_2.cpp . follow the instructions given on exercise 2. there is also testing case and hints provided.

please write the code in c++. and please follow the pattern or style provided on lab9_2.cpp.

thank you

New Tab e.com/drive/u/1 /folders/1ukCF7pL3UVOOR8JwEkulNxInLXAxftwbl Exercise 2: 401K Investments Download lab9_2.cpp. Attach the completed cpp file to your submission This exercise will require functions, loops, and if statements. Our task is to write a program to calculate investment amounts that grow in a 401K retirement account. When investing in a 401K your money is taxed BEFORE investing, and then grows tax free. For example, Example Sara invests $10,000 for 50 years. This quantity is taxed at 20% before she invests it. Each year, her total investment grows by the interest rate of 10%. At year 0, Total0 10000 0.8 8000 At year 1, Total-1=Total Atyear 2. Total-2= Total-1*1.10-10648 0 * 1.10 8800 At year 50, Total-50 Total-49 * 1.10 A loop is a great way to solve this problem (loop through every year)! Code We separate the problem into several functions. Try writing calculate401K and main to test them before you write print401KTable! 1. calculate401K a. Calculates final investment for a person investing some initial quantity in a 401K b. We specify the number of years invested, initial investment, tax rate, and interest rate as input parameters c. We must iterate through the given number of years, and calculate the final investment d. Don't forget to apply tax on the initial investment e. Be careful with decimals and percents (8% vs. 0.08) 2. print401 KTable a. Displays a bulk of information for various years given the initial investment b. The investor name, number of years, and initial investment are function inputs c. Print the investment value for every 10h year (eg. investing 10 years, 20 years, ...) d. At the end, print the total profit (profit after number of years minus initial investment) e. Assume the tax rate is 25% and the interest rate is 8% f. Use calculate401K in this function to help calculate investments after MN ears 3. main a. Test the calculate401K function with Sara, who invests $10,000 for 50 years with

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!