Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Bank Accrual Calculator Write a class to keep track of a balance in a bank account with a varying annual interest rate. The constructor

C++ Bank Accrual Calculator

Write a class to keep track of a balance in a bank account with a varying annual interest rate. The constructor will set both the balance and the interest rate to some initial values (with defaults of zero).

The class should have member functions to change or retrieve the current balance or interest rate. There should also be functions to make a deposit (add to the balance) or withdrawal (subtract from the balance). You should not allow more money to be withdrawn than what is available in the account, nor should you allow for negative deposits.

Finally, there should be a function that adds interest to the balance (interest accrual) at the current interest rate. This function should have a parameter indicating how many years worth of interest are to be added (for example, 0.5 indicate the account should have 6 months added).

Use the class as part of an interactive program that allows the user to determine how long it will take an initial balance will take to grow to a given value. The program should allow the user to specify the initial balance, the interest rate, and whether there are additional yearly deposits.

Your main function should act as a driver with a menu looping the program.

Example of header

class Account

{

private:

float balance;

float rate;

public:

Account();

float getBalace();

float getRate();

void Deposit(float amount);

void Withdrawal(float amount);

void AccrueInterest(int period);

};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

Students also viewed these Databases questions

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago