Question
Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula: futureInvestmentValue = investmentAmount * (1 + monthyInterestRate)numberOfYears*12 For example if you enter amount 1000, annual interest rate 3.25%, and number of years 1, the future investment value is 1032.98 Hint: Use the Math.pow(a,b) method to compute a raised to the power of b (Describe the problem including input and output in your own words.)
Explanation / Answer
#include #include using namespace std; int main() { //Enter initial investment amount cout > initialInvestment; //Enter annual interest rate cout > annualInterestRate; //Determine the monthly interest rate double monthlyInterestRate = annualInterestRate/1200; //Enter the number of years cout > numberOfYears; //Calculate the future investment double accumulatedValue = pow(initialInvestment * (1 + annualInterestRate),numberOfYears); //Keep two digits after the decimal point accumulatedValue = static_cast(accumulatedValue * 100) / 100.0; //Display the Investment Amount cout