Running the program Your program should take 5 arguments: start annual years return inflation where start is the initial investment amount annual is the amount that is added to the investment every year years is the number of years that the investment is held return is the annual investment return expressed as a percentage inflation is the annual inflation rate expressed as a percentage So, to calculate the future and present value of $1000 investment after 10 years where you add $100 every year with a 7% return and 2% inflation, you give the following arguments and get this output: $ ./fv 1000 100 10 7 2 Future Value: $3445.51 Present Value: $2826.52 Writing the code Starter code is provided for you below int main(int arge, char **argv ) { int a, n double value, present, I, is value= atof (argv[1]); a = atoi (argv[2]); natoi (argv[3]); r = atof (argv[4])/100; i = atof(argv[5])/100; // TODO write your code here printf ("Future Value: $%.2f\n", value) printf("Present Value: $%.2f\n", present); I have provided code to input the 5 arguments using argy and also code to print the results. Do not change this code. The first three arguments are integers, but the last 2 arguments are floating-point arguments, so that's why I use the double type and the atof function instead of atoi. Remember that the investment return and inflation rates are expressed as percentages - that's the reason for the divide by 100. You will need to write a loop that iterates over the number of years and accumulates the future value. Make sure to add the annual contribution every loop iteration. Note that it is possible to calculate the future and present value with a single equation, but for this problem, you are required to do the calculations using a loop. Do not use any functions from the built-in math library. You will need to create a function to calculate the power function so that you can get the denominator of the present value formula.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Running the program
Your program should take 5 arguments: start annual years return inflation
where
start is the initial investment amount
annual is the amount that is added to the investment every year
years is the number of years that the investment is held
return is the annual investment return expressed as a percentage
inflation is the annual inflation rate expressed as a percentage
So, to calculate the future and present value of $1000 investment after 10 years where you
add $100 every year with a 7% return and 2% inflation, you give the following arguments
and get this output:
$ ./fv 1000 100 10 7 2
Future Value: $3445.51
Present Value: $2826.52
Writing the code
Starter code is provided for you below
int main(int arge, char **argv )
{
int a, n
double value, present, I, is
value= atof (argv[1]);
a = atoi (argv[2]);
natoi (argv[3]);
r = atof (argv[4])/100;
i = atof(argv[5])/100;
// TODO write your code here
printf ("Future Value: $%.2f\n", value)
printf("Present Value: $%.2f\n", present);
I have provided code to input the 5 arguments using argy and also code to print the results.
Do not change this code. The first three arguments are integers, but the last 2 arguments
are floating-point arguments, so that's why I use the double type and the atof function
instead of atoi. Remember that the investment return and inflation rates are expressed
as percentages - that's the reason for the divide by 100.
You will need to write a loop that iterates over the number of years and accumulates the
future value. Make sure to add the annual contribution every loop iteration. Note that it
is possible to calculate the future and present value with a single equation, but for this
problem, you are required to do the calculations using a loop.
Do not use any functions from the built-in math library. You will need to create a function
to calculate the power function so that you can get the denominator of the present value
formula.
Transcribed Image Text:Running the program Your program should take 5 arguments: start annual years return inflation where start is the initial investment amount annual is the amount that is added to the investment every year years is the number of years that the investment is held return is the annual investment return expressed as a percentage inflation is the annual inflation rate expressed as a percentage So, to calculate the future and present value of $1000 investment after 10 years where you add $100 every year with a 7% return and 2% inflation, you give the following arguments and get this output: $ ./fv 1000 100 10 7 2 Future Value: $3445.51 Present Value: $2826.52 Writing the code Starter code is provided for you below int main(int arge, char **argv ) { int a, n double value, present, I, is value= atof (argv[1]); a = atoi (argv[2]); natoi (argv[3]); r = atof (argv[4])/100; i = atof(argv[5])/100; // TODO write your code here printf ("Future Value: $%.2f\n", value) printf("Present Value: $%.2f\n", present); I have provided code to input the 5 arguments using argy and also code to print the results. Do not change this code. The first three arguments are integers, but the last 2 arguments are floating-point arguments, so that's why I use the double type and the atof function instead of atoi. Remember that the investment return and inflation rates are expressed as percentages - that's the reason for the divide by 100. You will need to write a loop that iterates over the number of years and accumulates the future value. Make sure to add the annual contribution every loop iteration. Note that it is possible to calculate the future and present value with a single equation, but for this problem, you are required to do the calculations using a loop. Do not use any functions from the built-in math library. You will need to create a function to calculate the power function so that you can get the denominator of the present value formula.
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education