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

  Subsets of integers which sum to the same number

How many numbers do you require from this generator to guarantee that there exist 2 subsets of integers which  sum to the same number? Write steps how derive the solution.

  Explain how engineers be assigned to maximize sales

A sales manager has 3 areas and 5 sales engineers. If assignment of sales engineers to areas will result in expected sales as shown, how must engineers be assigned to maximize sales?

  Write and explain the definition of composition in c++

Write and explain the definition of composition in C++ and how it is useful in writing object-oriented programming. Also, explain how it is different from inheritance and how both inheritance and composition are useful in developing object-oriente..

  A robot

Mobile Robotics Kinematics

  Local telephone calls and long distance telephone calls

Will the distinction between local telephone calls and long distance telephone calls ever disappear? What may cause this to happen?

  Algorithm-adjusting playout delay at starting of each talk

Let the adaptive playout delay algorithm. Demonstrate through the simple example which adjusting the playout delay at starting of each talk spurt results in compressing.

  Create a program to keep track of the participants

Create a program to keep track of the participants in a triathlon. Your program will keep track of the times in three events: Running, Swimming, and Biking.

  Use a one-dimensional c-style array to solve

Use a one-dimensional C-style array to solve the following problem. Read in up to 20 numbers from the keyboard, each of the numbers should be between 10 and 100, inclusive.

  Capacity as a systems analyst

In your capacity as a systems analyst, you may face situations in which you encounter an ethical dilemma. For example, you may be asked to design a system that supports an activity with which you personally disagree

  The marie simulator

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

  Reflect upon the it strategies

Reflect upon the IT strategies that are used to encourage economic development. Select two strategies and discuss how economic factors affect the strategies that a government may use to facilitate economic development.

  Write down macro definitions for adding and subtracting

Write down macro definitions for adding and subtracting two arguments.

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