Hello, I trying to complete a project for my c++ class, but do not know where to start. The project is a banking assignment using derived classes and pure virtual functions, I will need to derive classes (such as checking and savings) off of the abstract class as described below.
bankAccount: Every bank account has an account number, the name of
the owner, and a balance. Therefore, instance variables such as name,
accountNumber, and balance should be declared in the abstract class
bankAccount. Some operations common to all types of accounts are retrieve
account owner’s name, account number, and account balance; make deposits;
withdraw money; and create monthly statement. So include functions to
implement these operations. Some of these functions will be pure virtual.
I have created what I think should be the bankAccount class, but I am unsure how to build it's constructor / initialize it since I can't instantiate an object of this class.
Any help is appreciated. Thank you.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <string>
using namespace std;
class bankAccount
{
public:
bankAccount(string fname="", string lname="", int acctNum = 0, double bal = 0); //constructor
string getAccountHoldersFname() const; // Get account holders first name
string getAccountHoldersLname() const; // Get account holders last name
int getAccountNumber() const; //get account number
int getAccountBalance() const; // get account balance
virtual void getMonthlyStatement(int month) = 0; // Print a statement
virtual void deposit(double depositAmount) = 0; // Deposit money into the account
virtual void withdraw(double withdrawAmount) = 0; // Withdraw money
protected: // these can be used in derived classes
void loadAccounts();
string AccountHoldersFname;
string AccountHoldersLname;
int accountNumber;
double balance;
};
|