Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and Savings). All the bank customers can deposit (Credit) money

Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and Savings). All the bank customers can deposit (Credit) money into their account and/or withdraw (debit) money from their account. Create necessary classes and Java application to use and test these classes.

Savings Accounts - earn interest on the money in the account.

Checking accounts - charges a fixed fee for each transaction the customer makes.

Create base class Account, with derived classes SavingsAccount and CheckingAccount that inherit from Account

Account:

contains - initialBalance

Constructors, getter/setters

validation for initialBalance,

credit() - make input is correct and positive and credit the account

debit() - make sure there is enough money, otherwise it should left unchanged

Account:SavingsAccount

Inherit from Account

additional property called interestRate (percentage assigned to account)

SavingsAccount Constructor should receive initialBalance, value for interestRate

method calculateInterest() that returns the amount of interest

CheckingAccount

Inherit from Account

additional instance variable for fee charged per transaction

Constructor should receive the initialBalance and fee amount

Should redefine debit () and credit () to take under consideration the fee charged

Now create and application that creates objects of each class to test each method. Add interest to the savingsAccount object by first invoking its caculateInterest () method, then pass the returned interest amount to the object's credit () method.

Develop a polymorphic banking application using the Account hierarchy. Create an array of Account references to SavingsAccount and CheckingAccount objects. For each account in the array, allow the user to specify an amount of money to withdraw from the account using method debit() and an amount to deposit into the account using the method deposit(). As you process each Account, determine its type. If an account is a SavingsAccount, calculate the amount of interest owed to the Account using method calculateInterest(), then add the interest to the account balance using method credit(). After processing an Account, print the updated balance obtained by using the getBalance() from the base class.

Interactively ask the user for information for each account and then print the result for each account.

Create Custom Exception NegativeBalanceException for the cases when user try to withdraw amount beyond available balance.

UML Diagram for assignment, make sure to use software to do the flow charts (use correct symbols)

Make sure your code if well commented

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

List the steps of the action of most nonsteroid hormones.

Answered: 1 week ago

Question

1. What are turning points and how do they aff ect relationships?

Answered: 1 week ago