Question: Please make sure to write code using Java programming language! Thank you. undefined Create an inheritance hierarchy that a bank might use to represent customers'

Please make sure to write code using Java programming language! Thank you. Please make sure to write code using Java programming language! Thankundefined

Create an inheritance hierarchy that a bank might use to represent customers' bank accounts. Customers 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. Checking accounts, for instance, charge a fee per transaction (i.e., per credit or debit). Your inheritance hierarchy must contain superclass Account and subclass checkingAccount that inherits from class Account. Superclass Account should include a data member (attribute) of type double to represent the account balance. The class should provide a constructor that receives an initial balance and uses it to initialize the data member. The Superclass should provide three methods. Method credit is used to add an amount to the current balance. Method debit withdraws money from the Account and ensures that the debit 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 the current account balance." Method getBalance returns the current balance. Subclass checkingAccount should inherit from superclass 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 override methods credit and debit so that they subtract the fee from the account balance whenever either transaction is performed successfully. CheckingAccount's versions of these methods should invoke the base class Account version to perform the updates to an account balance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!