Create an inheritance hierarchy

Assignment Help Basic Computer Science
Reference no: EM13219464

Create an inheritance hierarchy that a bank might use to represent customers' bank accounts. All customers at this bank can deposit (i.e. credit) money into their accounts and withdraw (i.e. debit) money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction (i.e., credit or debit). Create an inheritance hierarchy containing base class Account and derived classes SavingsAccount and CheckingAccount that inherit from class Account. Base class Account should be an abstract class and should include one data member of type double to represent the account balance and another data member of type String to hold the name of the person the account belongs to. The class should provide a constructor that receives a name and an initial balance and uses these information to initialize the data members. The default constructor of this class should initialize the name to an empty string and the balance to 0.0. Add all necessary setter and getter methods to this class. The setter method for balance should validate that balance being set is greater than or equal to 0.0. If not the method should display an error message. The class should also provide two member methods Credit and Debit. Member method Credit(double amount) should add amount to the current balance. Member method Debit(double amount) should withdraw money (reduce balance by amount) from the Account and ensure that the amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the method should print the message "Debit amount exceeded account balance.". Finally add an abstract method named Print which will be implemented in the derived classes.

Reference no: EM13219464

Questions Cloud

Explain the normal probability distribution : The mean life of these batteries follows the normal probability distribution with a mean of 35 hours. hours and a standard deviation of 5.6 hours. As a part of its quality assurance program, Power +, Inc. tests samples of 9 batteries.
Describe the reactance theory : Describe the Reactance Theory and explain why people sometimes do precisely the opposite of what they are told to do.
What is the point estimate of the population mean : Warren County Telephone Company claims in its annual report that "the typical customer spends $55 per month on local and long-distance service." A sample of 12 subscribers revealed the following amounts spent last month. $66,$63,$68,$60,$61,$60,$6..
Explain the current marketing communication : Describe the current marketing communication, identity, and brand position of Plaza Home Health Services. Conduct a Strengths Weaknesses Opportunities Threats (SWOT) analysis associated with the current marketing communication, identity, and brand ..
Create an inheritance hierarchy : Finally add an abstract method named Print which will be implemented in the derived classes.
Should these types of restrictions be made into law : The European Community has proposed a set of laws that would strictly limit how database information is used and who has access to it.
Find who experiences a decrease in consumer surplus : Alex is willing to pay $10, and Bella is willing to pay $8, for 1 pound of ribeye steak. When the price of ribeye steak increases from $9 to $11, Answer Alex experiences a decrease in consumer surplus, but Bella does not.
Write a function prototype for a function : Write a complete function called calcTriArea that will calculate and return the area of a triangle. It takes two float/double values: the base and height as its arguments. The area of a triangle is one-half the base times the height.
Resolve this problem within wireless technology : You can resolve this issue by wiring but you do not want to do that. What can you do to resolve this problem within wireless technology?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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