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.

I need code for this ASAP PLZ. Part 1 - LAB -Bank Accounts(100%) In this workshop, you create an inheritance hierarchy for thebank 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 themoney they hold. Checking accounts charge a fee per transaction (i.e. forevery credit and debit)- Class Hierarchy: The design of your Account hierarchy

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 Winclude include "iAccount.h" Winclude "SavingsAccount.h" using namespace sodds; using namespace sto; // display inserts account information for client void display(const chart client, iAccounts const acct , int n) { int lineLength = strlen(client) + 22; cout. fill( 's" ); cout. width (lineLength) ; cout display (cout); if (i credit(2803);cout debit (1069); Angelina [1]->debit (500); cout monthEnd () ; Angelina [1]->monthEnd() ; display( "Angelina", Angelina, 2); close (Angelina, 2); return ; Saving Tester Output DISPLAY Accounts for Angelina: Account type: Savings Balance: $460.60 Interest Rate (2) : 5.60 Account type: Savings Balance: $480.60 Interest Rate (2): 5.06 DEPOSIT $2060 into Angelinads Accounts . .. WITHDRAW $1030 and $580 from Angelina's Accounts ... DISPLAY Accounts for Angelina: Account type: Savings Balance: $1400.80 Interest Rate (2): 5.06 Account type: Savings Balance: $1900.80 Interest Rate (X) : 5.60 DISPLAY Accounts for Angelina: Account type: Savings Balance: $1470.06 Interest Rate (X): 5.80 Account type: Savings Balance: $1995.00 Interest Rate (X): 5.80ChequingAccount Class (concrete class) The ChequingAccount class derives from the Account class and holds the transaction fee and month-end fee to be applied to the account. Attributes transaction fee (double) monthly fee (double) public constructor and methods ChequingAccount (double, double, double) - constructor receives a double holding the initial account balance, a double holding the transaction fee to be applied to the balance and a double holding the month-end fee to be applied to the account. If the transaction fee received is positive-valued, this function stores the fee. If not, this function stores 0.0 as the fee to be applied. If the monthly fee received is positive-valued, this function stores the fee. If not, this function stores 0.0 as the fee to be applied. bool credit (double) - this modifier credits the balance by the amount received and if successful debits the transaction fee from the balance. This function returns true if the transaction succeeded; false otherwise. bool debit (double) - this modifier debits the balance by the amount received and if successful debits the transaction fee from the balance. This function returns true if the transaction succeeded; false otherwise. void monthEnd() - this modifier debits the monthly fee from the balance, but does not charge a transaction fee for this debit. vod 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: Chequing Balance: $xxxx.xx Per Transaction Fee: X.xx Monthly Fee: X.xx The Allocator Module (coded and provided) The Allocator module pre-defines the accounts rates and charges and defines the global function CreateAccount that creates the Account object from the types of account available. The rates and charges are: interest rate 0.05 (59%) transaction fee 0.50 monthly fee 2.00 CreateAccount global function iAccount* CreateAccount (const char*, double) - this function receives the address of a C-style string that identifies the type of account to be created and the initial balance in the account and returns its address to the calling function. If the initial character of the string is 'S", this function creates a savings account in dynamic memory. If the initial character of the string is 'C', this function creates a chequing account in dynamic memory. If the string does not identify a type that is available, this function returns nullptr.Tester Program // Workshop 8 - Virtual Functions and Abstract Base Classes // File: main. cpp // Version: 2.0 // Author: Chris Szalwinski, based on previous work by Heidar Davoudi // Description: // This file tests at_home section of your workshop !include Winclude include "iAccount.h" using namespace sodds; using namespace sto; // display inserts account information for client void display (const chart client, iAccounts const acct , int n) { int lineLength = int(strlen(client) + 22); cout. fill ( '*'); cout. width(lineLength) ; cout display (cout); if (i credit(2009); cout debit (1060); Angelina [1]->debit (500); cout monthEnd () ; Angelina [1]->monthEnd ( ) ; display( "Angelina", Angelina, 2); close (Angelina, 2);Expected Output DISPLAY Accounts for Angelina Account type: Savings Balance: $460.60 Interest Rate (2): 5.60 Account type: Chequing Balance: $460.60 Per Transaction Fee: 0.58 Monthly Fee: 2.06 DEPOSIT $2060 into Angelina Accounts ... WITHDRAW $1030 and $500 from Angelina's Accounts ... 4844544 DISPLAY Accounts for Angelina: Account type: Savings Balance: $1400.09 Interest Rate (X) : 5.80 Account type: Chequing Balance: $1899.06 Per Transaction Fee: 0.50 Monthly Fee: 2.06 DISPLAY Accounts for Angelina: Account type: Savings Balance: $1470.06 Interest Rate (2) : 5.60 Account type: Chequing Balance: $1897.06 Per Transaction Fee: 0.50 Monthly Fee: 2.06 PART 1 Submission (lab) Files to submit: iAccount.h Account. h Account . cpp Allocator. cpp SavingsAccount.h SavingsAccount . cpp main.cpp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!