Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 use 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. - Develop a driver program to fully test the application. - Make your assumptions for any info that is not given or additional info you add to the application. Marking is based on the following criteria: Completing and executing the correct program: 70% Program design, style, comments, structure, readability, efficiency: 30%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions