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 haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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