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

  Program to report page number and offset of virtual address

Your program will report page number and offset of given virtual address with specified page size. Page sizes should be specified as power of 2 in the range 1024-16384 (inclusive).

  Create application which gets customer account data

Some interest Credit Company gives loans to customers at 1.5 percent interest per month. Create the application which gets customer account data which includes the account number, customer name, and balance due.

  Write a program that prompts the user to enter the mass

Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds. Output both the mass and the weight rounded to two decimal places

  Create an application that manipulates a billboard sign

Create an application that manipulates a billboard sign. The program must include a Billboard class (separate from the main program class) that is capable of storing the text to display.

  Program in c# that simulates the operation of the turtle

Write a program in C# that simulates the operation of the turtle and implements a computerized sketchpad. Write several turtle graphics programs that draw interesting shapes to use for testing your program.

  Draw a flow chart to outline how you want to solve

Those cards should be revealed for the remainder of the game - you are required to draw a flow chart to outline how you want to solve this problem.

  Demonstrate that you can read and understand code

What will the code output when run - What are individualScores, bonusScore, baseScore, and teamScore? What do you think the difference is between the keywords let and var?

  Write script in unix to monitor creation of pdf in directory

Write script in unix which monitors creation of .pdf or PDF file in current directory. Every minute it must display list of these filenames created after previous display a list.

  Write code to concatenate strings separated by space

Write a few lines of code (need not be a separate function) to: Concatenate strings a and b separated by space into a string f. Print it.

  Explaining class definition of subclass of square

Write down the class definition of subclass of Square called FancySquare which has a method called getDiagonal. The getDiagonal method gets no arguments.

  Recursive double function

each of these returns the list consisting of each element of list y in a list has been replaced by two copies of the elements and

  Design an application for the homestead furniture store

Design an application for the Homestead Furniture Store that gets sales transaction data, including an account number, customer name, and purchase price.

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