Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a a C++ program that will calculate the future value for an annuity. -1 Fu

ID: 643900 • Letter: W

Question

Write a a C++ program that will calculate the future value for an annuity. -1 Future value = (1 + i)/i x monthly payment i = Interest Rate/12 n = Number of years x 12 The program should ask the user to input his first name, last name, interest rate, number of years and the monthly payment. The program should add 0.5% to the interest rate if the number of years is larger than 20 years. Once the values are entered, the program should calculate the fumy value. The output should be printed in an organize way; Customer name: Zee Haddad Monthly Payment: 2,000.00 Number of years: 15 Interest Rate: 5% Future value: 534,577.89 Customer name: Joe Haddad Monthly Payment: 2,000.00 Number of years: 25 Interest Rate: 5% Future value: 1,284,074.87 The program should repeat until the user types in Q for quit. The program should verify the inputs: 0

Explanation / Answer

Program:-

#include<iostream>

#include<string>

using namespace std;

int main()

{

       double future_value=0,i=0,n=0,monthly_payment=0,Interest_Rate=0,years=0,j=0;

       string fname;

       string lname;

       char ch=' ';

       cout<<"Enter the first name: ";

       cin>>fname;

       cout<<"Enter the last name: ";

       cin>>lname;

       while(true)

       {

              cout<<"Monthly payment: ";

              cin>>monthly_payment;

              if(monthly_payment<0 || monthly_payment>5000)

              {

                     cout<<"Monthly payment should be >0 and <5000";

                     continue;

              }

              else

                     break;

       }

       while(true)

       {

              cout<<"Number of years: ";

              cin>>years;

              if(years<0 || years>36)

              {

                     cout<<"No.of years should be >0 and <36";

                     continue;

              }

              else

                     break;

       }

      

       cout<<"Interest Rate: ";

       cin>>Interest_Rate;

       while(ch!='Q')

       {

              if(years>20)

                     Interest_Rate=Interest_Rate+0.5;

              i=Interest_Rate/12;

              n=years*12;

              j=i+1;

              future_value=((pow(j,n)-1)*monthly_payment)/i;

              cout<<"i:"<<i<<endl;

              cout<<"n:"<<n<<endl;

             

              cout<<"Future value:"<<future_value<<endl;

              cout<<"Do you want to continue? Y for yes, Q for NO: ";

              cin>>ch;

       }

      

      

       system("pause");

       return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote