Create inheritance hierarchy containing base class

Assignment Help Programming Languages
Reference no: EM1367777

Create an inheritance hierarchy containing base class Account and derived classes SavingsAccount and CheckingAccount that inherit from class Account. Make sure all fields, methods, and parameters are declared abstract, final, public, private, protected where appropriate.

Base class Account should include one data member of type double to represent the account balance. The class should provide aa 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 an error message, indicating that the initial balance was invalid.

The class should provide several methods. Method credit should add an amount to the current balance. Method 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 an error message. Method getBalance should return the current balance.

Derived class SavingsAccount should inherit the funcionality of an Account, but also inclute a data member of type double indicating the yearly interest rate (percentage) assigned to the account. SavingsAccount's constructor should receive the initial balance, as well as an initial value for the SavingsAccount's interest rate. SavingsAccount should provide a method applyInterest that applies the interest rate of the account to its balance, increasing the 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. Its constructor should receive the initial balance, as well as a parameter indicating the fee. The credit and debit methods should be redefined to subtract the fee from the account balance whenever either transaction is performed successfully. Note that you must not duplicate code.

Remember to test your code extensively before submitting. Submit the three .java files containing the above classes.

Reference no: EM1367777

Questions Cloud

Asset market model and exchange rates. : Suppose the spot exchange rate in dollars and yen is e=$1/100yen. The interest rate on a 6 months dollar denominated assets is i($)=1 percent and interest rate on comparable 6 months yen denominated assets
Economics-decision making in multi-national firms : Can you articulate how macroeconomics and microeconomics come into play in the context of firm decision-making in a global business. Please provide an example.
Understanding of transcultural concepts : What unique features of families require an understanding of transcultural concepts? Describe factors the nurse will require to consider when planning culturally appropriate nursing care.
Underestimating actual costs : Assume the military bureaucracy consistently misinforms Congress on total costs of producing military hardware. Suppose that it underestimates the actual costs and that the political representatives believe these estimates.
Create inheritance hierarchy containing base class : Create an inheritance hierarchy containing base class Account and derived classes SavingsAccount and CheckingAccount that inherit from class Account.
Important information regarding nursing research : According to Polit and Beck (2006), nurses in different settings are adopting a research-based (or evidence-based) practice which incorporates research findings into their decisions and interaction with clients.
Determinants of demand or supply : Identify which of the determinants of demand or supply are affected and also indicate whether demand or supply increases or decreases.
Optimal price and output combination : Assume an airline flying on the New York - Chicago route has estimated the demand curves for three different types of customers: business (no advance purchase), leisure (7 day advance purchase), and discount (14 day advance purchase) travelers.
Determine the value of the spot rate : Assume that on January 1, 1999 spot exchange rate was Yen/£=198. Over the year, British inflation rate was 4 percent, and the Japanese inflation rate was 6 percent.

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