Write a program that calculates the final value of a ten year, $10,000 investment whose annual return gradually declines from 2% to 1% over that term. Solution //Header file section #include<iostream> using namespace std; //Program begins with a main function int main() { //Initialize variables double investment=10000, highIntrest=0.02,changeIntrest=0.01,years=10,result; //prompt output cout<<\"Year \"<<\"Final_value \"<<endl; //Calculate the final value of a ten year for(int i=1;i<=10;i++) { investment = (investment* highIntrest)+investment; highIntrest=changeIntrest; cout<<i<<\"Â Â Â Â \"<<investment<<endl; } cout<<\"Final Value of a ten year=\"<<investment<<endl<<endl; //Pause the system for a while system(\"pause\"); return 0; } .
Write a program that calculates the final value of a ten year, $10,000 investment whose annual return gradually declines from 2% to 1% over that term. Solution //Header file section #include<iostream> using namespace std; //Program begins with a main function int main() { //Initialize variables double investment=10000, highIntrest=0.02,changeIntrest=0.01,years=10,result; //prompt output cout<<\"Year \"<<\"Final_value \"<<endl; //Calculate the final value of a ten year for(int i=1;i<=10;i++) { investment = (investment* highIntrest)+investment; highIntrest=changeIntrest; cout<<i<<\"Â Â Â Â \"<<investment<<endl; } cout<<\"Final Value of a ten year=\"<<investment<<endl<<endl; //Pause the system for a while system(\"pause\"); return 0; } .