Answer to Question #58501 in C++ for ziyad

Question #58501
Suppose you have a certain amount of money in a saving account that earns compound monthly interest, and you want to calculate the amount that you will have after a specific number of months. The formula, which is known as future value formula, is:

F = P X (1 + i) ^ t

The terms in the formula are as following:

F is the future value of the account after the specified time period.
P is the present value of the account.
i is the monthly interest rate.
t is the number of months.

write a program that prompts the user to enter the account's present value, monthly interest rate, and the number of months that the money will be left in the account. The program should pass these values to a function named futureValue that returns the future value of the account, after the specified number of months. The program should display the account's future value.
1
Expert's answer
2016-03-18T15:48:05-0400
#include <iostream>
#include <cmath>
using namespace std;

double futureValue(double value, double rate, int num_month){ return value * pow(1 + rate / 100, num_month); }

int main() {
double P, i;
int t;
cout << "Input your present value, monthly interest rate and number of months under the \nspace:";
cin >> P >> i >> t;
cout << "Your future value: " << futureValue(P, i, t) << endl;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS