Question: CpE 2 0 1 : Java Programming Course - Dr . Mohammad Allaho Running Example Exercises Bank Account Application - Programming Exercises Inheritance: The bank
CpE: Java Programming Course Dr Mohammad Allaho
Running Example Exercises
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
setRatedouble must be between and
getRate returns double
setBaseint
getBase returns int
setFeesint
getFees returns int
calculateInterest
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
