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

-----------CODE------------- #include<iostream> using namespace std; float Perce

ID: 3856605 • Letter: #

Question

-----------CODE-------------

#include<iostream>

using namespace std;

float Percent_0 = 0;

float Percent_001 = .001;

float Percent_002 = .002;

float Percent_015 = .015;

float Interests_checking(double accbal)

{

float Interests;

if (accbal<100)

{

Interests = accbal * Percent_0;

}

else if (accbal>100 && accbal <1000)

{

Interests = accbal * Percent_001;

}

else if (accbal>1000)

{

Interests = accbal * Percent_002;

}

cout<< "The amount of interests earned for" << " " << "$" << accbal << " " << "is" << " " << Interests << endl;

return Interests;

}

float Interests_Saving(double accbal)

{

float Interests;

if (accbal<=100)

{

Interests= accbal* Percent_0;

}

else

{

Interests = accbal * Percent_015;

}

cout<< "The amount of interests earned for" << " " << "$" << accbal << " " << "is" << " " << Interests << endl;

return Interests;

}

int menu()

{

int choice;

cout << "1.Checking "

<< "2.Saving "

<<"Enter 1 or 2:";

cin>>choice;

  

while ( choice != 1 && choice !=2)

{

  cout<< "Error! Re-enter:" << endl;

  cin >> choice;

}

return choice;

}

int main()

{

int choice;

double balance;

float Total;

choice = menu();

cout << "Enter account balance" << endl;

cin >> balance;

if (choice==1)

{

Total = Interests_checking(balance) + balance;

}

else if (choice==2)

{

Total = Interests_Saving(balance) + balance;

}

cout<< "The total amount is : " << "$" << Total << endl;

return 0;

}

-----------------------------------------------------

Hi can someone help me please, I've written the code above as an answer for the question..Whar can I add to the code to repeat the menu and calculate the total amount of interests for more than one bank account? PLEASE HELP

Thank you in advance

Please write a modular program that calculates the total amount of interest earned for a group of bank accounts. The user should be allowed to specify the number of bank accounts. The amount of interest earned on a single account can be calculated by multiplying the account balance by the percent interest. Use the information in the table below to calculate the interest on an account. Type of Account Checking Checking Checking Savings Savings Account Balance Percent Interest

Explanation / Answer

#include<iostream>
using namespace std;

//percentage
float Percent_0 = 0;
float Percent_001 = .001;
float Percent_002 = .002;
float Percent_015 = .015;

//Function to returns checking account interest
double Interests_checking(double accbal)
{
//To store interest
double Interests;
//If account balance is less than 100
if (accbal<100)
{
//Calculates interest
Interests = accbal * Percent_0;
}//End of if
//If account balance is greater than 100 and less than 1000
else if (accbal>100 && accbal <1000)
{
//Calculates interest
Interests = accbal * Percent_001;
}//End of else if
//If account balance is more than 1000
else if (accbal>1000)
{
//Calculates interest
Interests = accbal * Percent_002;
}//End of else if
//Displays interest
cout<< "The amount of interests earned for" << " " << "$" << accbal << " " << "is" << " " << Interests << endl;
//Returns interest
return Interests;
}//End of function

//Function to returns saving account interest
double Interests_Saving(double accbal)
{
//To store interest
double Interests;
//If account balance is less than or equals to 100
if (accbal<=100)
{
//Calculates interest
Interests= accbal* Percent_0;
}//End of if
//For more than 100
else
{
//Calculates interest
Interests = accbal * Percent_015;
}//End of else
//Displays the interest
cout<< "The amount of interests earned for" << " " << "$" << accbal << " " << "is" << " " << Interests << endl;
//Returns interest
return Interests;
}//End of function

//Returns menu choice
int menu()
{
//To store choice entered by the user
int choice;
//Accepts user choice
cout << "1.Checking "<< "2.Saving "<<"Enter 1 or 2:";
cin>>choice;
//Loops till user choice is not 1 or 2
while ( choice != 1 && choice !=2)
{
//Accepts user choice
cout<< "Error! Re-enter:" << endl;
cin >> choice;
}//End of while
//Returns choice
return choice;
}//End of function

//Main function definition
int main()
{
//To store choice return from menu function
int choice;
//To store balance
double balance;
//To store total interest
double Total = 0.0;
//To store choice for more account
char ch;
//Loops till N or n is entered by the user
do
{
//Calls the menu function for type of account
choice = menu();
//Accepts the balance
cout << "Enter account balance" << endl;
cin >> balance;
//If choice is one
if (choice==1)
{
//Calculates the total interest
Total += Interests_checking(balance);
}//End of if
//If choice is 2
else if (choice==2)
{
//Calculates the total interest
Total += Interests_Saving(balance);
}//end of else if
//Accepts user choice for more account
cout<<" Do you want to enter any other account information? (Y/N): ";
cin>>ch;
//If choice is N or n then break
if(ch == 'N' || ch == 'n')
break;
}while(ch == 'y' || ch == 'Y');
//Display the total interest
cout<< "The total amount is : " << "$" << Total << endl;
return 0;
}//End of main

Output:

1.Checking
2.Saving
Enter 1 or 2:1
Enter account balance
120
The amount of interests earned for $120 is 0.12

Do you want to enter any other account information? (Y/N): y
1.Checking
2.Saving
Enter 1 or 2:2
Enter account balance
1000
The amount of interests earned for $1000 is 15

Do you want to enter any other account information? (Y/N): y
1.Checking
2.Saving
Enter 1 or 2:1100
Error! Re-enter:
2
Enter account balance
1100
The amount of interests earned for $1100 is 16.5

Do you want to enter any other account information? (Y/N): n
The total amount is : $31.62