A bank updates t customers'' accounts at the end of each month. The bank offers two types of accounts: savings and checking. Every customer must maintain a minimum balance. If a customer's balance falls below the minimum balance, there is a service charge of $10.00 for savings accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the minimum balance, the account receives interest as follows:
a) Savings accounts receive 4% interest.
b) Checking accounts with balances up to $5,000 more than the minimum balance receive 3% interest; otherwise, the interest is 5%.
write a program that reads a customers account number (char; S for savings, C for checking), minimum balance that the account should maintain, and current balance.The program should than output the account number,account type,current balance and interest earned and appropriate message . test your program by running five times , using the following data:
46728 S 1000 2700
87324 C 1500 7689
79873 S 1000 800
89832 C 2000 3000
98322 C 1000 750.
my code:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
// Declare Variables
int acctNumber;
char acctType;
float acctBalance;
double interest;
double minimumBalance;
// For input, get the account number, account type, and current balance
cout << "Enter the Account Number: ";
cin >> acctNumber;
cout << "Account Type" << endl;
cout << "C = Checking Account" << endl;
cout << "S = Savings Account" << endl;
cout << "Enter the Account Type: ";
cin >> acctType;
cout << "Enter minimum account Balance: ";
cin >> minimumBalance;
cout << "Enter the Account Balance: ";
cin >> acctBalance;
if (acctType == 'S' && acctBalance < minimumBalance)
{acctBalance = acctBalance - 10.00;}
if (acctType == 'C' && acctBalance < minimumBalance)
{acctBalance = acctBalance - 25.00;}
if (acctType == 'S' && acctBalance > minimumBalance)
{interest = (acctBalance * 4)/100;}
if (acctType == 'C' && acctBalance <= (minimumBalance + 5000.00) && acctBalance > minimumBalance)
{interest = (acctBalance * 3)/100;}
if (acctType == 'C' && acctBalance >= minimumBalance)
{interest = (acctBalance * 5)/100;}
cout << fixed << showpoint << setprecision(2);
cout << "Account Number: " << acctNumber << endl;
cout << "Account Type: " << acctType << endl;
cout << "Account Balance: $" << acctBalance << endl;
cout << "Amount of Interest Earned: $" << interest << endl;
}
i got the program runing good enough .. thats what i think
please feel free to tell me if you find any glitches or any improvements that i can make .. but the problem is this if some one enters account balance 0 than the account balance at end of month becomes $ -25.00. is this right or the program should print account balance is 0. What is the appropriate message that is asked for in the question? also the interest rate is 4% per year and we are updating the account every month so does that make any difference