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

If the account balance is 0 my guess is that the account should be closed and just delete it. That would probably indicate the person withdrew all the money so that he could go buy a new computer and is no longer interested in putting his money in your bank.

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

Perhaps you can put an error reminder that the person is inputting 0 as a account balance and output a message to the user if this is what they want to do.

For the interest problem is 4% each year so each month they accrue a certain %of the 4% correct? (1/12 of the 4%).

Your 4% interest should probably use a variance of the I = Prt equation where I is interest, P is principle, r is rate, and t is time. solving that for rate when you know that I will by .04P should give you a more accurate rate per month. Make sure t is set to 12 also. You should out put a message such as "Account X has a balance of $0" and if you decide to delete it also inform the user of that.

Regarding the -25.00 .. I guess it would mean that the customer owes the bank 25 dollars as a service fee for letting the balance drop below their minimum balance ..

You might want to throw a warning message if the customer enters a balance which is less than the minimum balance and where balance - 25 < 0 or balance - 15 < 0 .. and prompt them to enter the balance again ? Because anytime your min balance is < 25 or 15 (depending on the account) and your account balance is less than that you will get a negative value.

sir if some one can send me program code for bank database using link list and file handling as soon as possible...........

email id: Puranchandra248@gmail.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.