Write a class that simulates managing a simple bank account

Assignment Help Programming Languages
Reference no: EM131316517

The exercise for this week is to write a class that simulates managing a simple bank account. The account is created with an initial balance. It is possible to deposit and withdraw funds, to add interest, and to find out the current balance. This should be implemented in class named Account that includes:

• A default constructor that sets the initial balance to zero.

• A constructor that accepts the initial balance as a parameter.

• A function getBalance that returns the current balance.

• A method deposit for depositing a specified amount.

• A method withdraw for withdrawing a specified amount.

• A method addInterest for adding interest to the account.

The addInterest method takes the interest rate as a parameter and changes the balance in the account to

balance*(1+interestRate).

The UML diagram for the Account class is shown in figure 1.

-balance: double

+Account();

+Account(double);

+double getBalance();

+void deposit(double );

+void withdraw(double);

+void addInterest(double);

Account

Your class must work with the code given below and display the output .

240

450

Lab7.cpp (main)

#include

using namespace std;

#include "Account.h"

int main()

{

Account a1;

Account a2(500);

a1.depost(200);

a2.withdraw(50);

a1.addInterest(0.2);

cout<<a1.getBalance();

cout<<"\n";

cout<<a2.getBalance();

system("pause");

return 0;

}

Reference no: EM131316517

Questions Cloud

Preferred stock with an annual dividend : Preferred Products has issued preferred stock with an annual dividend of $5.90 that will be paid in perpetuity. A. If the discount rate is 10% at what price should the preferred sell? Current price? B. At what price should the stock sell 1 year from ..
Write the introduction to your proposal : Write the introduction to your proposal. Add the three physical development activities that you created in week two into the appropriate room in the template. Make sure to incorporate any instructor feedback
How many goods will china gain in seigniorage : Suppose that Japan (country a) and China (country b) do not have foreigncurrency controls in effect. The total demand for money is always 2,000 goods in Japanand 1,000 goods in China. The fiat money supplies are 100 yen in Japan and 300 RMB in China...
Which is a function of pmo project monitoring : A unique responsibility of the PMO is assessing and elevating enterprise project management ability (competency, capability, and maturity), which is a function of PMO project monitoring
Write a class that simulates managing a simple bank account : Write a class that simulates managing a simple bank account. The account is created with an initial balance. It is possible to deposit and withdraw funds, to add interest, and to find out the current balance.
Find the natural frequencies as a function of the mass m : A plate of mass m, supported by a slender straight beam as shown in the Fig. P5.7, vibrates while sinusoidal force is applied to the center of the plate. Find the natural frequencies as a function of the mass m, flexural rigidity EI of the beam, a..
Calculate the binomial interest rate tree : Assume annual compounding of interest for these problems. Assume 10% annual interest rate volatility. Calculate the binomial interest rate tree using the 2-year on-the-run issue and the 3-year on-the-run issue.
Define pm assessment in context of the pmo : For this assignment, address the following items: Define PM assessment in context of the PMO infrastructure management. Describe the primary domains of encompassing PMO assessment
Write program that calculate and prints the monthly paycheck : Write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions: Federal Income Tax: 15%.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a program to create three identical list

Write a program to create three identical list, list1, list2, and list3, of 5000 elements. The program then sorts list1using quick sort, list 2 using insertion sort.

  Print the list of array of numbers

Print the list of array of numbers and then print linked list with the equivalent character side by side to. output file Specifications:

  Evaluate the arithmetic expressions

Prepare a Lisp program to evaluate the arithmetic expressions - If the input is legal, your program should output the final result of the expression evaluation, as given in the above case. If the input is illegal, the result is undefined, i.e., you..

  Write program to enter last names of five candidates

Write down the program which permits the user to enter last names of five candidates in local election and number of votes received by each candidate.

  Write a program that creates a scintillation grid

Write a program that creates a scintillation grid

  Unix systems administration

Unix Systems Administration

  Explain the problem of storing data in matrix

Each such element is accompanied by its two indexes (the row and the column). Explain in what ways such structure is similar to and/or different than list.

  Write program that calculates average score of class

write program that calculates average score of class and shows the result. All description written in word file. Program should read datas

  What are the benefits of the two when developing a compiler

What is the difference between top-down and bottom-up parsing

  Consider monthly demand for the abc corporation as shown in

consider monthly demand for the abc corporation as shown in the table below. with these demand values estimate a static

  Write pseudocode-read in data file containing student name

Write a pseudocode to do the following Read in data file containing student names, ID number, and gender into an array.

  Write a program that will allow the user to sum two integers

Write a program that will allow the user to sum two integers up to 20 digits big. The integers should be stored in a string with no more than size 20. The integers will be read in as a string, not an integer.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd