Can someone help me with this program Modify the savings account program from Fi
ID: 3936031 • Letter: C
Question
Can someone help me with this program Modify the savings account program from Figure 9-18 in Chapter 9. Follow the instructions for starting C++ and viewing the Intermediate 19.cpp file, which is contained in either the Cpp8Chap10Intermediatel9 Project folder or the Cpp8Chapl0 folder. (Depending on your C++ development tool, you may need to open this exercises 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 Minimum rate (in decimal form): 0.02 Maximum rate (in decimal form): 0.04 Rate 2%: Year 1: $1020.00 Year 2: $1040.40 Year 3: $1061.21 Rate 3%: Year 1: $1030.00 Year 2: $1060.90 Year 3: $1092.73 Rate 4%: Year 1: $1040.00 Year 2: S1081.60 Year 3: $1124.86
Explanation / Answer
#include <iostream>
void getBalance(float);
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
float balance =0.0,min,max,deposit=0;
int a,b;
int i;
cout << "DEPOSIT: " ;
cin >> balance;
deposit =balance;
cout << "MINIMUM interest rate(in decimal form): ";
cin >> min;
cout << "MAXIMUM interest rate(in decimal form): ";
cin >> max;
a = ((max*100) - (min * 100))+1;
for(b=1;b<=a;b++){
switch(b){
case 1:cout << "Rate "<< b << "%:" << " ";
for(i=1;i<=3;i++){
balance = balance + (balance *(min)) ;
cout << " Year"<< i <<": " << balance << " ";
}
break;
case 2:cout << "Rate "<< b << "%:" << " ";
min = min + 0.01;
balance = deposit;
for(i=1;i<=3;i++){
balance = balance + (balance *(min)) ;
cout << " Year"<< i <<": " << balance << " ";
}
break;
case 3:cout << "Rate "<< b << "%:" << " ";
balance = deposit;
for(i=1;i<=3;i++){
balance = balance + (balance *(max)) ;
cout << " Year"<< i <<": " << balance << " ";
}
break;
}
}
cout << "Initial deposited amount =" ;getBalance(deposit) ;
return 0;
}
void getBalance(float deposit){
cout << deposit;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.