Question: I need code for this ASAP PLZ. Part 1 - LAB - Bank Accounts(100%) In this workshop, you create an inheritance hierarchy for the bank
I need code for this ASAP PLZ.







Part 1 - LAB - Bank Accounts(100%) In this workshop, you create an inheritance hierarchy for the bank accounts of a bank's clients. All clients can deposit (i.e., credit) money into their accounts and withdraw (i.e., debit) money from their accounts. Two specific types of accounts exist Savings accounts earn interest on the money they hold. Checking accounts charge a fee per transaction (i.e. for every credit and debit)- Class Hierarchy: The design of your Account hierarchy is illustrated in the following Figure. An interface named iAccount exposes the hierarchy's functionality to a client module that uses its features. The abstract base class named Account holds the balance for an account, can credit and debit an account transaction and can expose the current balance in the account. The two account types derive from this base class. The SavingsAccount class and the ChequingAccount class inherit the properties and functionality of the Account base class. iAccount Class public Account Class + iAccount 4 public public ChequingAccount SavingsAccount Class Class + Account + Account Implementation Implement the following classes: 1. iAccount - the interface to your hierarchy - store it in a file named iAccount.h 2. Account - an abstract base class that manages the common operations - store its definition and implementation in files named Account.h and Account.cpp. 3. SavingsAccount - a concrete class - store its definition and implementation in files named SavingsAccount.h and SavingsAccount.cpp. 4. ChequingAccount - a concrete class - store its definition and implementation in files named ChequingAccount.h and ChequingAccount.cpp. 5. the Allocator Module (coded and provided) - In a separate file named Allocator.cpp the function that allocates dynamic memory for an account based on its dynamic type is provided. Study and understand this function before the final tester program. This function is to be declared in the iAccount Interface module (see below) iAccount Interface: The iAccount interface includes the following pure virtual public member functions: bool credit (double) - adds a positive amount to the account balance bool debit (double) - subtracts a positive amount from the account balance void monthEnd() - applies month-end transactions to the account void display (std::ostream&) const - inserts account information into an ostream object This interface also declares a public empty virtual destructor. This interface also declares the following helper function (this global function is already coded and is provided in the allocator module and will be used at final submission)iAccount* CreateAccount (const chart, double) - receives a C-style string identifying the type of account and the initial account balance, creates the account with the starting balance and returns its address. Account Class (abstract base class) The Account class derives from the iAccount interface. Attribute The current balance (a double value); Public constructor and methods Account (double) - constructor receives either a double holding the initial account balance or nothing. If the amount received is not positive-valued or no amount is received, this function initializes the current balance to 0.0. If the amount received is positive-valued, this function initializes the current account balance to the received amount. bool credit (double) - receives an amount to be credited (added) to the account balance and returns the success of the transaction. If the amount received is positive-valued, the transaction succeeds and this function adds the amount received to the current balance. If the amount is not positive-valued, the transaction fails and this function does not add the amount received. bool debit (double) - receives an amount to be debited (subtracted) from the account balance and returns the success of the transaction. If the amount received is positive-valued, the transaction succeeds and this function subtracts the amount received from the current balance. If the amount is not positive-valued, the transaction fails and this function does not subtract the amount received. Protected method double balance() const - returns the current balance of the account. SavingsAccount Class (concrete class) The SavingsAccount class derives from the Account class and holds the interest rate that applies to the account. This class includes the following public member functions: SavingsAccount ( double, double) - constructor receives a double holding the initial account balance and a double holding the interest rate to be applied to the balance. If the interest rate received is positive-valued, this function stores the rate. If not, this function stores 0.0 as the rate to be applied. void monthEnd() - this modifier calculates the interest earned on the current balance and credits the account with that interest. void display (std::ostreams) const - receives a reference to an ostream object and inserts the following output on separate lines to the object. The values marked in red are fixed format with 2 decimal places and no fixed field width: Account type: Savings Balance: $xxxx.xx Interest Rate (X): X.xxSaving Tester Program // Workshop 8 - Virtual Functions and Abstract Base Classes // File: savings_tester. cpp // Version: 2.0 // Author: Chris Szalwinski, based on previous work by Heidar Davoudi // Description: // This file implements the Account class // revised by Fardad Soleimaniloo Winclude
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
