Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can some write this code for me? It is a single program BankAccount Class Design a BankAccount class that stores the account's annual interest rate

Can some write this code for me? It is a single program

BankAccount Class

Design a BankAccount class that stores the account's annual interest rate and balance. the class constructor should accept the amount of the account's starting balance and Annual Interest Rate. The class should also have methods for subtracting the amount of withdrawal, add the amount of deposit, and adding the amount of monthly interest to the balance. The monthly interest rate is the annual interest rate divided by 12. To add the monthly interest to the balance, multiply the monthly interest rate by the balance, and add the result to the balance. ( this is compound interest ) Format output to 2 decimal places.

Test the class in a program that calculates the balance of a savings account at the end of a period of time. It should ask the user for the annual interest rate, the starting balance, and the number of months that have passed since the account was established, or prompt after each loop iteration to continue.

Set up Accumulator variables: totalInterest, totalDeposits, totalWithdrawals

Prompt for starting balance and annual Interest Rate

Create a SavingsAccount object.

Loop through each of the following steps for each set of Input Data:

Prompt the user for the amount deposited into the account during the month. Use the class method to add this amount to account balance.

Prompt the user for the amount withdrawn from the account during the month. Use the class method to subtract the amount from the balance.

Use the class method to calculate the monthly interest.

After the last monthly interest calculation, display the ending balance, the total of deposits, the total of withdrawals, and the total interest.

class BankAccount { private: double balance; // Account balance double annualInterestRate;

public: BankAccount(double startBalance, double annualinterestrate); void deposit(double amount); void withdraw(double amount); double getBalance(); void setBalance(double b); double calculateInterest(); };

Run the Program for this Program Data:

Starting Balance Annual Interest Rate Months Deposits/Withdrawals
1000.00 10% 6 Deposit 100.00 per month for first 3 months Withdraw 100.00 per month for last 3 months

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

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

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

What is Apple inc system of rules?

Answered: 1 week ago

Question

Recognize the power of service guarantees.

Answered: 1 week ago

Question

Demonstrate how to use the Gaps Model for diagnosing and

Answered: 1 week ago