This what I have from my last assignment on creating a bank account. This is what i have to add for the next assignment and I'm lost. Can someone please help me do this!!
Assignment:
1. Create 3 subclasses that inherit from the bank account class created in homework 3. They are Checking, Savings, and CD.
For Checking:
Override the debit method, there is now a per check fee. When we debit money charge a processing fee each time. Account type is “CH”.
For Savings:
Add a private static member for interest rate. Add a method that will calculate the monthly interest and add it to the balance. Also implement a minimum balance check. This should run the same time as the monthly interest, if the account has less than $250, then there is a $5 maintenance fee that should be deducted from the balance.
For CD:
Add a private static member for the interest rate. Add a member to keep track of the number of debits. This account has a limit of 3 withdrawals per year. After the 3rd withdrawal, there is a 2% transaction fee (min $5) for each withdrawal. Add a method that will rollover the account, which indicates that a year has passed, the CD has reached its term, so we will reset the withdrawal count and apply the annual interest rate.
2. Test the new classes as before, create an array of BankAccount objects, assign the elements of the array to new elements of the different classes that we have. Call all of the methods making use of polymorphic behavior that we have for our debit and credit methods.
#include <iostream>
#include <string>
using namespace std;
class BankAccount
{
private:
static int number;
int AcctNumbr;
string OwnerName;
string Accounttype;
double CurrentBalance;
public:
//void BankAccount::withdraw (double amount)
BankAccount(void);
BankAccount( string , double ) ;
void withdraw( double );
double getBalance() const;
};
int BankAccount::number = 1001;
BankAccount::BankAccount( void )
{
}
BankAccount::BankAccount( string OwnerName, double balance ) // You have an overloaded constructor here but no prototype in class definition
{
cout << "default constructor.";
Accounttype = "GA";
CurrentBalance = balance;
this ->OwnerName = OwnerName;
}
void BankAccount::withdraw (double amount) // Good for debit method but where is it in the class definition?
{
if( amount > 0 && CurrentBalance >= amount )
{
CurrentBalance -= amount;
}
}
double BankAccount::getBalance() const
{
return CurrentBalance;
}
int main ()
{
BankAccount bankList[10];
int nextAcntIndex = 0;
string name;
double balance;
int Accountnumber;
int Withdrawl;
cout << " Welcome to World Bank " << endl;
int choice;
do {
system("cls");
cout << endl;
cout << " United Bank" << endl;
cout << " Select a menu option" << endl;
cout << " 1. Creating an Account" << endl;
cout << " 2. Debt" << endl;
cout << " 3. Current Balance " << endl;
cout << " 4. credit " << endl;
cout << " 5. Exit " << endl;
cout << endl;
cout << " Enter your choice by using the numbers -->> ";
cin >> choice;
cin.clear();
cin.ignore( INT_MAX, '\n' );
switch( choice ) {
case 1:
system( "cls" );
cout << "Enter your name: ";
cin >> name;
cout << "Enter your balance: ";
cin >> balance;
bankList[nextAcntIndex] = BankAccount( name, balance);
nextAcntIndex++;
break;
case 2:
system( "cls" );
cout << "Enter Account number; ";
cin >> Accountnumber;
cout << "Enter Withdrawl; ";
cin >> Withdrawl;
bankList [Accountnumber - 10001].withdraw ( Withdrawl );
break;
case 3:
cout << " Enter Account number; ";
cin >> Accountnumber;
cout << "Currentbalance" << bankList [Accountnumber - 10001].getBalance ();
break;
case 4:
cout << "Enter Account number; ";
cin >> Accountnumber;
cout << "Enter balance; ";
cin >> balance;
break;
case 5:
default:
cout << "That wasn't a choice";
break;
}
} while( choice !=5 );
return 0;
}