So im kindave stuck on this problem i have and would greatly appreciate some help. i pasted the question in and the code that i have written so far im just lost on what i need to do next really.
Angela and Marcus recently married and wanted to start saving for their future children’s college tuition. Write a program that will allow them to enter a yearly amount of savings to compound over the next 18 years at various amounts of payments per year and interest rates. In other words, your program will ask for the amount of savings per year and the annual interest rate.
Create a value-returning function to calculate the below formula. Therefore, the below formula will not be in the main function.
The formula to find the future value is FV = PMT(((1 + i)n – 1)/ i )) .
FV = Future value
PMT = Amount paid per year
i = Interest
n = Number of years
It may be helpful to use the pow function available through the header file cmath.
Be sure to output the information to show the decimal point and trailing zeros to two places.
The cost of in-state tuition is $10,250 * 4 for four years. With the proper control structure(s), determine whether the child will need to borrow money for the four years or will be supported by Pell grants, which supplement parents with incomes below $50,000 a year. Children whose parents make more than $50,000 do not qualify for Pell grants.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
double futureValue;
double PMT;
double i;
double n = 18;
cout << fixed << showpoint << setprecision(2);
cout << "Enter the amount you plan to invest each year: ";
cin >> PMT;
cout << endl;
cout << "Enter the estimated interest rate in decimal format: ";
cin >> i;
cout << endl;
futureValue = PMT * (((pow((1 + i), n)) - 1) / i);
cout << "If you invest $" << PMT << " for " << n << " years "
<< "with an interest rate of " << i*100 << "%" << " then you will have $"
<< futureValue << " for your children's future college fund. " << endl;
system("pause");
return 0;
}
| |