Hi ,
I am stuck with my this bank account programming. The question is like this:
Create a base class Bank of a bank account with member functions to allow withdrawal, deposit and calculation of balance. Account should have a name, account number and type.
Create derived class Saving of a saving account, which allows overdraft up to $8000 and gives interest of 2% per annum. Create another derived class Current of a current account, which does not allow overdraft and does not give any interest.
Create two objects of the derived classes with initial deposits of $2000 and $5000 each. Demonstrate the use of various member functions for withdrawal, deposit, interest calculation for one month, showing balance and giving warning when the account balance is zero or less.
The display can be as given below (user inputs are in bold):
Account Name: Jacky Chan(in bold)
Account No: 12345(in bold)
Type: Saving
Balance: $6000
Enter positive amount to deposit and negative to withdraw: $1000(in bold)
Balance: $7000
Interest next month: $11.67
This is what i have done so far:
#include <iostream>
#include <string>
using namespace std;
class Bank
{
private:
string myname;
int number;
double changes;
public:
void SetBank(string , int , double);
void EnterName();
void ShowName(void );
void EnterNumber();
void ShowNumber(void );
void EnterChanges();
void ShowChanges(void );
};
void Bank::SetBank(string name, int num, double c)
{
myname = name;
number = num;
changes = c;
}
void Bank::EnterName()
{
cout<<"Please enter your Account Name: ";
cin>>myname;
}
void Bank::ShowName()
{
cout<<"\n\nAccount Name: "<<myname<<endl;
}
void Bank::EnterNumber()
{
cout<<"Please enter your Account Number: ";
cin>>number;
}
void Bank::ShowNumber()
{
cout<<"Account No: "<<number<<endl;
}
void Bank::EnterChanges()
{
cout<<"Please enter positive amount to deposit and negative to withdraw: $";
cin>>changes;
}
void Bank::ShowChanges()
{
cout<<"Enter positive amount to deposit and negative to withdraw: $"<<changes<<endl;
}
void main()
{
Bank bank;
bank.EnterName();
bank.EnterNumber();
bank.EnterChanges();
bank.ShowName();
bank.ShowNumber();
bank.ShowChanges();
cout<<"\n\n\n ^_^ Thank you for using this program ^_^ "<<endl;
cout<<" Have a nice day "<<endl;
}
Please >.< i need a detail explanation how the program work ... Thankk in advance