Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LAB 5 - BANK ACCOUNTS This lab is an extension of Lab3 - an application that manages two types of bank accounts: savings and checking.

LAB 5 - BANK ACCOUNTS

This lab is an extension of Lab3 - an application that manages two types of bank accounts: savings and checking.

Lab3 implements a base bank account class that manages the basic operations of a bank account, such as deposits and withdrawals. The specifics of a checking account and savings account should now be managed by more specialized classes Checking and Savings. They will each inherit the basic operations of the basic BankAccount class and define their more specialized features.

The Savings account class will add interest rate as a feature. The interest earned in that account will be calculated at the end of the month when a function named MonthlyProc is called. This function should also reset the number of withdrawals and deposits.

The Checking account class will manage the fees. After the first 5 withdrawals (which are free), there is a pre-defined fee that needs to be subtracted from the balance for each subsequent withdraw. The monthlyProc function that will run at the end of the month needs to reset the number of withdrawals and deposits.

The interest rate for a savings account should be defined as a parameter passed to the savings account constructor. The fee should be passed as a parameter to the checking account constructor.

Define a printStatement function in each subclass to print the specifics of each type of account then call the base class printStatement that you already implemented. The specifics of each type of account should include a header and the interest rate or fee.

It is important that you use what is already implemented in the base BankAccount class by calling its methods. Do not replicate what is already implemented in BankAccount, since reusability of code is one of the main purposes of object oriented programming. The more specialized class is supposed to extend the base class. For example, the Checking::deposit member function should call the BankAccount::deposit to do the basic updates and just add the behavior that is specific to checking. Same for Savings and any other member function that you redefine.

You need to write a main function to test your classes, but you don't have to turn it in. I will use my own, so it is very important that you don't change the header files, or the class specification that I'm providing. Only turn in Checking.cpp and Savings.cpp with the subclasses implementations of each member function.

The following is provided:

Checking.h: The specification of your checking account class, which is a subclass of BankAccount. Do not change this file. You will implement the member functions in the Checking.cpp

Savings.h: The specification of your savings account class, which is a subclass of BankAccount. Do not change this file. You will implement the member functions in Savings.cpp

Turn in your implementation of Checking.cpp and Savings.cpp only.

Savings:

#ifndef Savings_hpp #define Savings_hpp

#include #include "BankAccount.h"

class Savings : public BankAccount { private: double interestRate; public: Savings(); Savings(double amt, double intRate); void withdraw(double amt); void deposit(double amt); void monthlyProc(); void printStatement() const; };

#endif /* Savings_hpp */

Checking:

#ifndef Checking_hpp #define Checking_hpp

#include "BankAccount.h"

class Checking : public BankAccount { private: double fee; public: Checking(); Checking(double amt, double intRate); void withdraw(double amt); void deposit(double amt); void monthlyProc(); void printStatement() const; };

#endif /* Checking_hpp */

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions