Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write this program in C. Question 1 Investment calculator Create a program that asks the user for an initial investment amount, a number of
Please write this program in C.
Question 1 Investment calculator Create a program that asks the user for an initial investment amount, a number of years, a return rate, and an additional contribution per year. The program should then output a neatly formatted table of the investment returns from year one until the final year. All dollar figures in the table should output with 2 digits of precision. The table columns should be: Year, Start Balance, Interest and End Balance. The year column should be 10 characters in length, the others should be 20 characters in length. The data in all columns should be left-aligned. Use a for loop to compute and present the table of data. Enter initial investment amount: 20000 Enter total years: 10 Enter return rate: 6 Enter additional contribution per year: 1000 Year Start Balance 1 2 3 4 5 6 7 8 9 10 20000.00 22200.00 24532.00 27003.92 29624.15 32401.60 35345.70 38466.44 41774.43 45280.89 Interest ***** 1200.00 1332.00 1471.92 1620.24 1777.45 1944.10 2120.74 2307.99 2506.47 2716.85 End Balance ***** 21200.00 23532.00 26003.92 28624.15 31401.60 34345.70 37466.44 40774.43 44280.89 47997.75 Your program should work either identical or nearly identical this example. If the user enters a negative number in the case of any of the dollar figures, or 0 or a negative number in the case of the year, print an appropriate error message and ask the user to input the data againStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started