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

not sure what to do here 19. In this exercise, you will modify the savings accou

ID: 3936475 • Letter: N

Question


not sure what to do here

19. In this exercise, you will modify the savings account program from Figure 9-18 in Chapter 9. Follow the instructions for starting C++ and viewing the Intermediate19.cpp file, which is contained in either the Cpp8Chap10 Intermediate19 Project folder or the Cpp8Chap10 folder. (Depending on your C++ development tool, you may need to open this exercise's project/solution file first.) Modify the program to allow the user to enter the minimum and maximum interest rates, as shown in Figure 10-27. Also change the getBalance function to a void function. Test the program appropriately. Deposit: 1000 Mininum rate (in decimal form): 0.02 Maximum rate (in decimal form): 0.04 Rate 2%: Year 1: $1020.00 Year 2: S1040.40 Year 3: $1061.21 3%; Year 1: $1030.00 Year 2: $1060.90 Year 3: $1092.73 Rate Rate 4%: Year 1: $1040.00 Year 2: $1081,60 Year 3: S1124, 86

Explanation / Answer

/* Programme Begins */

#include<iostream> //header for inputs operations
#include <iomanip>           //// std::setprecision if you want use
using namespace std;
void getBalance(int,float,float);       //function declaration to display balance

int main()
{
   int deposit,t,i;                                           //varible declarations
   float minr,maxr;
       //reading principal amount ,intrest rates min,max with prompts asking input                                          
   cout<<"Enter Deposit Amount : ";                      
   cin>>deposit;
   cout<<"Enter Minimum Rate(in decimal form) : ";
   cin>>minr;
   cout<<"Enter Minimum Rate (in decimal form) : ";
   cin>>maxr;
  
   getBalance(deposit,minr,maxr);                       //calling get balance method with arguments deposit amount,min & max rates
  
  
   return 0;
}
void getBalance(int dep,float min,float max)
{
float rate,year1total,year2total,year3total;                               //declare varibles
for(rate=min;rate<=max;rate=rate+0.01 )                                       //loop repeates between min ,max interest rates with incrementation 0.01
{
   cout<<"Rate " << min*100 << "% : "<<endl;
  
           year1total= dep+(dep*rate*1);
           cout<<"Year " << 1 << " : $"<< year1total <<endl;                       //find year 1 interest rate and display toatal
           year2total= year1total+(year1total*rate*1);
           cout<<"Year " << 2 << " : $"<< year2total <<endl;                           //find year 2 interest rate and display toatal
           year3total= year2total+(year2total*rate*1);
           cout<<"Year " << 3 << " : $"<< year3total <<endl;                       //find year 3 interest rate and display toatal
  
  
}


}

Output :

Enter Deposit Amount : 1000
Enter Minimum Rate(in decimal form) : 0.02
Enter Minimum Rate (in decimal form) : 0.04
Rate 2% :
Year 1 : $1020
Year 2 : $1040.4
Year 3 : $1061.21
Rate 2% :
Year 1 : $1030
Year 2 : $1060.9
Year 3 : $1092.73
Rate 2% :
Year 1 : $1040
Year 2 : $1081.6
Year 3 : $1124.86