Question: Q4. (30 Points) Implement the following application in Java. Upload the code and the output in a single PDF file. Also upload the java files
Q4. (30 Points) Implement the following application in Java. Upload the code and the output in a single PDF file. Also upload the java files (source code files). Write useful comments inside the code. 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
