Need help with this program I got the base class down but stuck on on the inheri
ID: 3647133 • Letter: N
Question
Need help with this program I got the base class down but stuck on on the inheritance classes. Thank YOU!!
Account class (base class)
Attributes:
account number
Account balance
Functions:
Default constructor: MUST initialize balance to zero
Set for account number
Get for account number
Get for account balance
//Function to deposit money into the account (this replaces the set)
Void Deposit(double);
//Function to withdraw money from the account
Bool Withdraw(double); //returns true if enough money, false if not
You should first code and test these functions which should handle simple deposits and withdraws. An example test would be
Create an account object
Store an account number in the object
Display the account number and balance (balance should be zero from constructor)
Add $100 using the deposit function
Display the balance
Withdraw $60
Display the balance
Withdraw $50
Should return false
Use that return to display message of insufficient funds
You NEED to have this working BEFORE you start on either of the derived classes. EMAIL ME with any problems up to this point!!
Checking Account
Adds attribute to keep track of number of withdraw transactions
Needs specific code to process a withdrawl (handle service charges)
Savings Account
Adds attribute for interest rate
Get balance needs to add interest
This is what I got so far...
header file
#pragma once
#include <string>
#include<iostream>
using namespace std;
class CBankAccount
{
protected:
double accountNum;
double balance;
double deposit;
double withdraw;
public:
CBankAccount() {balance =0;}
void setAccount(int);
double getAccount() { return accountNum; }
double getBalance();
void setDeposit(double);
bool setWithdraw(double);
};//end class
Cpp. file
#include"CBankAccount.h"
void CBankAccount::setAccount(int num)
{
accountNum = num;
}
double CBankAccount::getBalance()
{
return balance;
}
void CBankAccount::setDeposit(double dep)
{
balance= balance + dep;
}
bool CBankAccount::setWithdraw(double wit)
{
balance= balance - wit;
}
driver file
#include <iostream>
#include <ctime>
#include <iomanip>
#include <cmath>
#include<string>
using namespace std;
#include "CBankAccount.h"
void main()
{