Question

In: Computer Science

Problem Statement: Banks offer various types of accounts, such as savings, checking, certificate of deposits, and...

Problem Statement:

Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet with their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write. Another type of account that is used to save money for the long term is certificate of deposit (CD).

In this programming exercise, you use abstract classes and pure virtual functions to design classes to manipulate various types of accounts. For simplicity, assume that the bank offers three types of accounts: savings, checking, and certificate of deposit, as described next.

Scenarios in every types of bank accounts:

Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no minimum balance and a lower interest rate and another that requires a minimum balance and has a higher interest rate.

Checking accounts: Suppose that the bank offers three types of checking accounts: one with a monthly service charge, limited check writing, no minimum balance, and no interest; another with no monthly service charge, a minimum balance requirement, unlimited check writing and lower interest; and a third with no monthly service charge, a higher minimum requirement, a higher interest rate, and unlimited check writing.

Certificate of deposit (CD): In an account of this type, money is left for some time, and these accounts draw higher interest rates than savings or checking accounts. Suppose that you purchase a CD for six months. Then we say that the CD will mature in six months. Penalty for early withdrawal is stiff.

Available Classes:

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.

checkingAccount: A checking account is a bank account. Therefore, it inherits all the properties of a bank account. Because one of the objectives of a checking account is to be able to write checks, include the pure virtual function writeCheck() to write a check.

serviceChargeChecking: A service charge checking account is a checking account. Therefore, it inherits all the properties of a checking account. For simplicity, assume that this type of account does not pay any interest, allows the account holder to write a limited number of checks each month, and does not require any minimum balance. Include appropriate named constants, instance variables, and functions in this class.

noServiceChargeChecking: A checking account with no monthly service charge is a checking account. Therefore, it inherits all the properties of a checking account. Furthermore, this type of account pays interest, allows the account holder to write checks, and requires a minimum balance.

highInterestChecking: A checking account with high interest is a checking account with no monthly service charge. Therefore, it inherits all the properties of a no service charge checking account. Furthermore, this type of account pays higher interest and requires a higher minimum balance than the no service charge checking account.

savingsAccount: A savings account is a bank account. Therefore, it inherits all the properties of a bank account. Furthermore, a savings account also pays interest.

highInterestSavings: A high-interest savings account is a savings account. Therefore, it inherits all the properties of a savings account. It also requires a minimum balance.

certificateOfDeposit: A certificate of deposit account is a bank account. Therefore, it inherits all the properties of a bank account. In addition, it has instance variables to store the number of CD maturity months, interest rate, and the current CD month.

Note that the classes bankAccount and checkingAccount are abstract. That is, we cannot instantiate objects of these classes. The other classes in Figure above are not abstract.

Solutions

Expert Solution

public:

//CONSRTRUCTOR noServiceChargeChecking SETS THE NAME, ACCOUNT NUMBER, BALANCE

noServiceChargeChecking(int acctNum, string name, double initialBalance)

    : checkingAccount(acctNum, name, initialBalance)

{

    m_InterestRate = 2.5; // Some interest rate

    m_ChecksRemaining = -1; // -1 indicates no limit

    m_MinimumBalance = 500; // Minimum balance

}

~noServiceChargeChecking(void){}

//IMPLEMENTING BASE CLASS writeCheck(double amount)

void writeCheck(double amount)

{

    if (m_Balance - amount < 0)

    {

      cout << "Declined: Insufficient funds remain to withdraw that amount" << endl;

      return;

    }

    m_Balance -= amount; // Assume check is cashed immediately...

}

//PRINT THE ACCOUNT SUMMARY

void printSummary()

{

    // Use the root base class to print common info

   // bankAccount::printSummary();

    cout << setw(25) << "INTEREST RATE: " << m_InterestRate << "%" << endl;

    cout << setw(25) << "MINIMUM BALANCE: $" << m_MinimumBalance << endl;

    cout << setw(25) << "UNLIMITED CHECKS   " << endl;

    cout << setw(25) << "NO MONTHLY SERVICE FEE   "<< endl;

    cout << setw(60) << setfill('-') << "" << setfill(' ') << endl;

}

   void withdraw(double amount)

{

//if m_balace is less than amount , tells the user insufficient balance. Not possible to withdraw

    if (m_Balance-amount < 0)

    {

      cout << "Declined: Insufficient funds remain to withdraw that amount" << endl;

      return;

    }

//otherwise withdraw amount

    m_Balance -= amount;

}

   void deposit(double amount)

{

    m_Balance += amount;

    cout << "$" << amount << " has been deposited to your account" << endl;

}

   void printStatement()

{

    printSummary();

    cout << "A FULL IMPLEMENTATION WOULD ALSO PRINT A SAVINGS ACCOUNT STATEMENT HERE." << endl;

}

};

savingsAccount.h

#include <iostream>

#include <iomanip>

#include <string>

#include "bankAccount.h"

using namespace std;

//CLASS savingsAccount DERIVED FROM bankAccount

class savingsAccount :

public bankAccount

{

public:

//CONSTRUCTOR savingsAccount THAT SETS NAME, ACCOUNT NUMBER, BALANCE AND INTEREST RATE

savingsAccount(int acctNum, string name, double initialBalance)

    : bankAccount(acctNum, name, initialBalance)

{

    m_InterestRate = 3.99;

}

//DESTRUCTOR

~savingsAccount(void)

{

}

//IMPLEMENTING withdraw(double amount)

void withdraw(double amount)

{

    if (m_Balance-amount < 0)

    {

      cout << "Declined: Insufficient funds remain to withdraw that amount" << endl;

      return;

    }

    m_Balance -= amount;

}

//PRINT THE SUMMARY

void printSummary()

{

    // Use the root base class to print common info

    bankAccount::printSummary();

    cout << setw(25) << "INTEREST RATE: " << m_InterestRate << "%" << endl << endl;

    cout << setw(60) << setfill('-') << "" << setfill(' ') << endl;

}

//PRINT THE MONTHLY STATEMENT

void printStatement()

{

    printSummary();

    cout << "A FULL IMPLEMENTATION WOULD ALSO PRINT A SAVINGS ACCOUNT STATEMENT HERE." << endl;

}

void deposit(double amount)

{

    m_Balance += amount;

    cout << "$" << amount << " has been deposited to your account" << endl;

}

  

  

protected:

double m_InterestRate;

};

serviceChargeChecking.h

#include <iostream>

#include <iomanip>

#include <string>

#include "checkingAccount.h"

using namespace std;

const int MAX_CHECKS=5;

const double SVC_CHARGE=10.0l;

double m_ChecksRemaining;

double m_InterestRate;

double m_MinimumBalance;

class serviceChargeChecking :

public checkingAccount

{

public:

//CONSTRUCTOR THAT SETS NAME, ACCOUNT NUMBER, BALANC, INTEREST RATE, NO OF CHECKS LEAFS, MINIMUM BALANCE

serviceChargeChecking(int acctNum, string name, double initialBalance)

    : checkingAccount(acctNum, name, initialBalance)

{

    m_InterestRate = 0; // No interest

    m_ChecksRemaining = MAX_CHECKS; // Limit of 5 checks

    m_MinimumBalance = 0; // No minimum balance

}

//DESTRUCTOR

~serviceChargeChecking(void){}

//IMPLEMENTS writeCheck(double amount) THAT GIVES CHECKS

void writeCheck(double amount)

{

    if (m_ChecksRemaining == 0)

    {

      cout << "DECLINED: NO MORE CHECKS REMAINING THIS MONTH" << endl;

      return;

    }

   

    if (m_Balance - amount < 0)

    {

      cout << "DECLINED: INSUFFICIENT FUNDS REMAIN TO WITHDRAW THAT AMOUNT" << endl;

      return;

    }

//REDUCE NO OF CHECK LEAFS BY 1

    m_ChecksRemaining--;

    m_Balance -= amount; // Assume check is cashed immediately...

    }

//PRINT THE SUMMARY

    void printSummary()

    {

      // Use the root base class to print common info

      bankAccount::printSummary();

      cout << setw(25) << "CHECKS REMAINING: " << m_ChecksRemaining << endl;

      cout << setw(25) << "MONTHLY SERVICE FEE: $" << SVC_CHARGE << endl;

      cout << setw(25) << "NO INTEREST " << endl;

      cout << setw(25) << "NO MINIMUM BALANCE " << endl;

      cout << setw(60) << setfill('-') << "" << setfill(' ') << endl;

    }

     void printStatement()

{

    printSummary();

    cout << endl << "A FULL IMPLEMENTATION WOULD ALSO PRINT DETAILS OF A CHECKING ACCOUNT STATEMENT HERE." << endl << endl;

}

     void withdraw(double amount)

{

    if (m_Balance-amount < 0)

    {

      cout << "Declined: Insufficient funds remain to withdraw that amount" << endl;

      return;

    }

    m_Balance -= amount;

}

     void deposit(double amount)

{

    m_Balance += amount;

    cout << "$" << amount << " has been deposited to your account" << endl;

}

};


Related Solutions

Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market,...
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write. Another...
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market,...
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write. Another...
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market,...
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet with their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write....
C++ 7th edition Banks offer various types of accounts, such as savings, checking, certificate of deposits,...
C++ 7th edition Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you...
Four different banks in town offer savings accounts that all pay a stated or quoted rate...
Four different banks in town offer savings accounts that all pay a stated or quoted rate of 2.5%. However, each bank compounds interest paid on the account differently. If you want to save money in one of these banks, which do you pick? The one that compounds: a. annually b. monthly c. quarterly d. weekly e. it does not make a difference because they all pay 2.5%
Assets Liabilities Reserves 250 Deposits   Required __     Transaction (checking) deposits 1000   Excess __      Savings deposits 3000...
Assets Liabilities Reserves 250 Deposits   Required __     Transaction (checking) deposits 1000   Excess __      Savings deposits 3000 Loans    Money Market deposits 500     Variable rate loans 750 Time deposits (CDs)     Short-term loans 1600     Fixed rate 500    Long-term fixed rate loans    2000     Variable rate 100 Securities Borrowing    Short-term securities 500     Fed funds borrowed 0    Long-term securities 600 a) Refer to the bank balance sheet above. Suppose values are in millions of dollars. Suppose return on assets (ROA) is 1.2%. Suppose bank owners convince...
C++ Language Oriented program. Please help me out with this project !!! Banks offer various types...
C++ Language Oriented program. Please help me out with this project !!! Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a...
Write a program to simulate a bank transaction. There are two bank accounts: checking and savings....
Write a program to simulate a bank transaction. There are two bank accounts: checking and savings. First, ask for the initial balances of the bank accounts; reject negative balances. Then ask for the transactions; options are deposit, withdrawal, and transfer. Then ask for the account; options are checking and savings. Then ask for the amount; reject transactions that overdraw an account. At the end, print the balances of both accounts. in if and else statments only in c++
What are the major types of deposits plans that depository institutions offer today?
What are the major types of deposits plans that depository institutions offer today?
There are various types of financial institutions and intermediaries such as commercial banks, investment banks, mutual...
There are various types of financial institutions and intermediaries such as commercial banks, investment banks, mutual funds, hedge funds, pension funds, insurance companies, etc. Why are there so many different financial intermediaries other than commercial banks? How does an investor’s risk attitude and/or wealth play a role in his/her selection of a financial institution or intermediary? If you were an investor seeking moderate return for your investment, how would you select a financial institution or intermediary? Choose one and explain...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT