Create inheritance hierarchy for customer-s bank account

Assignment Help Software Engineering
Reference no: EM1367013

Create an inheritance hierarchy that a bank might use to represent customer's bank accounts. All customers at this bank can deposit money into their accounts and withdraw money from their accounts. More specific types of accounts also exist. Saving accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction.

Create an inheritance hierarchy containing base class Account and derived classes SavingAccount and CheckingAccount that inherit from class Account. Base class Account should include one data member of type double to represent account balance. The class should include a constructor that receives an initial balance and uses it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0.0. if not, the balance should be set to 0.0 and the constructor should display error message, indicating that the initial balance is invalid. The class should provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money from the Account and ensure that the debit amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the function should print the message "debit amount exceeded account balance". Member function getBalance should return the current balance.

Derived class SavingAccount should inherit the functionality of an Account, but also include a data member of type double indicating the interest rate assigned to the Account. SavingAccount's constructor should receive the initial balance, as well as an initial value for the SavingAccount's interest rate. SavingAccount should provide a public member function calculateInterest that returns a double indicating the amount of interest earned by an account. Member function calculateInterset should determine this amount by multiplying the interest rate by the account balance.

Derived class CheckingAccount should inherit from base class Account and include an additional data member of type double that represents the fee charged per transaction. CheckingAccount's constructor should receive the initial balance, as well as a parameter indicating a fee amount. Class CheckingAccount should redefine member functions credit and debit so that they subtract the fee from the account balance whenever either transaction is performed successfully. CheckingAccount's versions of these functions should invoke the base class Account version to perform the updates to an account balance. CheckingAccount's debit function should charge a fee only if money is actually withdrawn (i.e., the debit amount does not exceed the account balance). [hint: define Account's debit function so that it returns a bool indicating whether money was withdraw. Then use the return value to determine whether a fee should be charged.]

After defining the classes in this hierarchy, write a program that creates objects of each class and tests their member functions. Add interest to SavingAccount object by first invoking its calculateInterest function, then passing the returned interest amount to the object's credit function

Reference no: EM1367013

Questions Cloud

Stockpiled lobster-price elasticity : Describe the effect of increase from 1998-1999. How would the increase in demand affect the price? How would the price effect depend upon the price elasticity of supply? Please describe how. (Explain the illustration instead of actually drawing it)
Create a class-how to cash goods-give change to customers : Write class called Cashier that directs a cashier how to cash goods and give change to customers. Typical cashier operations are as follows.
Calculate the current value of the bond : Due to a number of lawsuits related to toxic wastes, major chemical producre has recently experienced a market revaluation. The company has a bond issue outstanding with fifteen years to maturity and a coupon rate of 8 percent,
Demand and supply of cigarettes : What are some ways public policymakers can reduce demand of cigarettes (shift of the demand curve)? Assume the government decides to implement the tax on cigarette manufacturers in order to raise the price of cigarettes. How much does the amount of..
Create inheritance hierarchy for customer-s bank account : Create inheritance hierarchy which a bank might use to represent customer's bank accounts. All customers at this bank can deposit money into their accounts and withdraw money from accounts.
Calculating breakeven point and operating leverage : Schweser Satellites Corporation manufactures satellite earth stations that sell for $100,000 each. The company's fixed costs, F, are $2 million; 50 earth stations are produced and sold every year;
Own price elasticity of demand : Compute the cross-price elasticity of demand between goods X and Y at the given prices. What is the own price elasticity of demand at these prices?
Distinguish class templates and program with heading : Clearly distinguish each class templates and their program with heading. Elaborate each step and give it without errors. Develop classes or class templates for the following.
Question on market consequences of price floor : A price floor is set by the government to protect the producer of the good to which price floor has been attached. There're two possible outcomes for market in price floor setting.

Reviews

Write a Review

Software Engineering Questions & Answers

  Design entity relationship diagram for catered accommodation

Design an entity relationship diagram for the case, explaining any suppositions you deem essential for atered or non-catered accommodation at the centre.

  Draw class diagram for computing machine

Each problem reported by a distinct user is assigned a unique problem number (even if different users call in to report the same problem). Draw a class diagram that accurately reflects the system's requirements.

  State diagram for coffee machine controller

Design behavioral specs by using state diagram for coffee machine controller given below: State events. Machine operates ah hourly interval.

  Create flowchart to accept length of base of triangle

Create a flowchart that will accept the length of the base and height of a triangle and print the area. Area of a triangle is : area = 1/2b*h ; where b = base and h = height.

  Factors significant effects on initial cocomo estimate

Suggest four factors that might have significant effects on the initial COCOMO estimate and propose possible values for these factors.

  Prepare a business case for project

Business Case - Using the information that you compiled in the project proposal, prepare a Business Case for this project.

  Draw a flowchart to determine fare

Write an algorithm to find the bus fare based on distance travelled as per the following rates:a. Rs.5.00 for first 2 kms.

  Systems analysis and design methodologies

difference between "Requirements Determination" and "Requirements Structuring", deliverables on or after coding, testing and installation, distinction flanked by system documentation and user documentation, pertinent classes, attributes, operations

  Produce set of crc cards-uml diagram-javadoc comments

Produce a set of CRC cards, a UML diagram, and a set of javadoc comments (detailed JavaDoc only for each method created, no coding required).

  Number of block to fetch record-single level primary index

Assume one file has r =1000000 records. Each record takes R = 100 bytes, of which 10 bytes are for the key of the record. What is the least number of block accesses to fetch a record by using single level primary index?

  Investigate and analyse the effect of applying cmmi practice

ITECH3501- 6501 Principles of Software Engineering:  Investigate and analyse the effect of applying CMMI practices/processes in an Agile environment in terms of business performance improvement and the limitations/restrictions of using both, and writ..

  Grassroots computing changes way software is designed

Describe how grassroots computing changes the way software is designed, developed, tested, and maintained in typical organization. Write dwon the advantages and disadvantages of grassroots computing?

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