Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bank Account Application - Programming Exercises Inheritance: The bank has two types of bank accounts, one is called a saving account and the other is

Bank Account Application - Programming Exercises
Inheritance:
The bank has two types of bank accounts, one is called a saving account and the other is called a checking account. Both accounts have the basic information of class Account such as, clinet and balance, as well as class Account methods. In addition, each account type has the following new rules. Extend class Account to include the new features of each account.
Checking account is for customers who wish to receive their salaries direct to their account. The account stores the salary amount, allowing customers to withdraw money even if their balance is not sufficient up to an amount equal to half the salary.
Fields
Account holder salary: salary, type int
Methods
Override constructor with new fields
setSalary (int), it must be greater than zero.
getSalary (), returns int.
withdraw (), override from class Account. This method allows for overdraft withdraw for an amount of half the customer's salary.
tostring (), override from class Account to return the customer's info and balance in addition to the customer's salary.
Saving account is for customers who wish to receive interest on their saving balances. The account has a minimum balance to be eligible for interest. A balance below the minimum amount is charged a certain amount as a service fee. The minimum balance and fees are the same for all customers. The interest rate can vary from customer to customer.
Fields
Interest rate: rate, type double
Minimum balance: (static) base, type int
Service fees: (static) fees, type int
Methods
Override constructor with new fields
setRate(double), must be between 0 and 1
getRate (), returns double
setBase(int)
getBase(), returns int
setFees (int)
getFees(), returns int
calculateInterest()
Implementation: The method calculates the interest by multiplying the rate by the balance and adding the product to the balance. Before calculating the interest, the program must check if the balance is eligible or not. If not, then a message is displayed stating that the balance is below the base amount.
withdraw (), override from class Account. This method charges fees if withdraw amount causes a balance to be less than a base amount. The fees is subtracted from the balance (balance can be negative) and a statement must display the new balance after charges.
toString (), override from class Account to return the customer's info, and balance in addition to the customer's rate.
Testing:
For testing, in main, create a menu to show options such as withdraw, deposit to customers, in addition to calculate interest for saving accounts. The menu should be inside a while loop to allow a customer to withdraw or deposit multiple times until they select quit from the menu. It is optional to create one menu or two separate menus for each account type.
image text in transcribed

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions