//Write a program that calculates and prints the final value of a ten year, $10,000
//investment whose annual return gradually declines from 2% to 1% over that term.
#include <iostream>
using namespace std;
double yearlyreturn (double balance, double beginRate, double endRate, int years)
{
double rateofChange = (beginRate - endRate) / (years - 1);
balance = balance + balance*rateofChange;
}
double investment (double balance, double beginRate, double endRate, int year)
{
int years = 0 ;
while (years <= year)
{
yearlyreturn (balance, beginRate, endRate, years);
years = years + 1;
}
}
int main() {
cout << "The return on your investment is ";
cout << investment(10000, .02, .01, 10);
// the args cover all the necessary values
}
Thanks in advance!!!
Aucun commentaire:
Enregistrer un commentaire