QuestionQuestion

Problem description
The purpose of this assignment is to build an object-oriented program to process a list of bank transactions. Transactions include creating accounts, making deposits and withdrawals, adding accumulated interest, and deducting accumulated fees.

The following rules apply:
1. A bounced check costs $25 and is deducted immediately from the checking account balance.
2. There is a fee for each check (checking account withdrawal). Each checking account may use a different fee. The fees are charged as part of an update (see below).
3. Savings accounts accrue interest. Each savings account may have a different interest rate. Interest is credited as part of an update (see below).
4. An attempt made to withdraw more money than is available in a savings or checking account shall be rejected and a message indicating such shall be output.
The transaction file uses the following symbols: s, c, t, u, r, and d.
s - Create a new savings account. An account number, a name, an initial balance, and the interest rate are supplied.
c - Create a new checking account. An account number, a name, an initial balance, and the fee for each processed check are supplied.
t - Perform a transaction. An account number and the amount of the transaction are supplied. For savings accounts, a positive value is a deposit and a negative value is a withdrawal. For checking accounts, a positive value is a deposit and a negative value represents a withdrawal via a check.
u - Perform an update. An account number is supplied. For savings accounts, calculate and add interest earned. For checking accounts, calculate and deduct the fee for each check. Updates will only happen on an active account
r - Perform a transfer. Two account numbers are supplied. This will transfer the balance from one account to another. This will close the first account and create a new active account
d - List the number of accounts. No supplied values. This option will list the total number of accounts. It will also list the number of accounts of each type.
Use the list of transactions contained in bank.txt as input; there is no user input. All transactions shall be processed in a single loop. Assume that you wrote the program that generated the transaction file. Consequently, you know that all data are present and correct and that the formatting is consistent. This means that the file will always be formatted correctly (Accounts will always exist before an action is taken on them. You do not need to check input for errors).

Task 1. Create the Account base class with the following requirements:
The base class must contain all shared data variables
A protected type value must be stored that distinguishes the Account type
A protected 'active' state value
The name data type must be a char*
Add any other needed variables
A constructor must be created that allows the setting of the account type variable
Implement an overloaded equality operator function. The function should use the account number, account type, and active state for equality checking.
Create accessors for the active state
Implement a static function getNumberOfAccounts(). This function should return the total number of accounts.

Task 2. Create the Savings class with the following requirements:
Implement the constructor, which must pass the type using the base class constructor.
Implement function handleTransaction
Implement function handleUpdate
Implement the operator << function
A copy constructor must be created for transfers. This will copy the current balance and all other data members
Implement the equality operator. This function should use the base class equality and also check the new data members.
Implement a static function getNumberOfSavingsAccounts(). This function should return the total number of savings accounts.

Task 3. Create the Checking class with the following requirements:
Implement the constructor, which must pass the type using the base class constructor.
Implement function handleTransaction
Implement function handleUpdate
Implement the operator << function
A copy constructor must be created for transfers. This will copy the current balance and all other data members
Implement the equality operator. This function should use the base class equality and also check the new data members.
Implement a static function getNumberOfCheckingAccounts. This function should return the total number of checking accounts.

Task 4. Create a Bank class to handle all actions. This class should contain the following:
A private list(s) of accounts
Functions for creating each account type
Private function(s) for finding an account
Functions for handling all supplied actions. For example transactions, updates, creates, lists, etc
Load the symbols from the file. The file name must be loaded from the command line.

Extra
Build a user interface to the Bank software that will allow a Teller to interact with the system. The interface should validate inputs and allow all commands to be executed.
This should not break the file loading functionality!
Example Input
s 0 Dessie 1000.00 0.05
c 1 Andrew 400.00 0.25
t 1 -200.00
t 1 642.00
t 0 2000.00
t 1 -300.00
u 0
t 1 -100.00
t 1 -400.00
u 0
t 0 3000.00
u 1
t 1 -500.00
u 0
u 1
r 1 4
d

Example Output
new account...
Dessie (savings): balance is $1000.00
new account...
Andrew (checking): balance is $400.00
transaction...
Andrew (checking): $-200.00 applied to account
Andrew (checking): balance is $200.00
transaction...
Andrew (checking): $642.00 applied to account
Andrew (checking): balance is $842.00
transaction...
Dessie (savings): $2000.00 applied to account
Dessie (savings): balance is $3000.00
transaction...
Andrew (checking): $-300.00 applied to account
Andrew (checking): balance is $542.00
update...
Dessie (savings): $150.00 applied to account
Dessie (savings): balance is $3150.00
transaction...
Andrew (checking): $-100.00 applied to account
Andrew (checking): balance is $442.00
transaction...
Andrew (checking): $-400.00 applied to account
Andrew (checking): balance is $42.00
update...
Dessie (savings): $157.50 applied to account
Dessie (savings): balance is $3307.50
transaction...
Dessie (savings): $3000.00 applied to account
Dessie (savings): balance is $6307.50
update...
Andrew (checking): $-1.00 applied to account
Andrew (checking): balance is $41.00
transaction...
Andrew (checking): $-500.00 rejected (insufficient funds)
Andrew (checking): $-25.00 applied to account
Andrew (checking): balance is $16.00
update...
Dessie (savings): $315.38 applied to account
Dessie (savings): balance is $6622.88
update...
Andrew (checking): $-0.25 applied to account
Andrew (checking): balance is $15.75
transferring...
Andrew (checking): $15.75 transferred to checking account 4
Andrew (checking): balance is $15.75
listing all accounts…
There are a total of 3 accounts.
There are 1 savings accounts
There are 2 checking accounts

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include "Savings.h"

/**
* constructor
* @param balance
* @param name
* @param number
* @param rate
*/
Savings::Savings(double balance, char * name, int number, double rate)
: Account(saving, balance, name, number, true) {
    this->rate = rate ;
    numberOfSavingsAccounts++;
}

/**
* copy constructor
* @param o
*/
Savings::Savings(const Savings& o)
: Account(o.type, o.balance, o.name, o.number, o.activeState ) {   
    this->rate = o.rate;      
}

/**
* destructor
*/
Savings::~Savings() {
}

/**
* output overriding
* @param stream
* @param o
* @return
*/
ostream & operator<<(ostream &stream, const Savings & o){
    stream<<o.name<<" (savings): balance is $"<<o.balance;
    return stream;
}

/**
* equality operator
* @param o
* @return
*/
bool Savings::operator ==(const Savings& o) const{
    if (Account::operator ==(o) &&
            rate == o.rate) {
       return true;
    }
    return false;
}...
$50.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats