Assignment Objectives

After completing this assignment the student should be able to,

  • Write an abstract base class in Java according to Interface specifications given in UML.
  • Implement base class Interfaces in java according to specifications given in UML.

Assignment Requirements

For this assignment you are given a Java source code file (CSE205_Assignment01.java) with a main method and supporting methods. You must write the following Java files to complete the program:

BankAccount.java CheckingAccount.java
SavingsAccount.java CreditcardAccount.java

The specifications for these files are given below (including the UML diagram on the following page). Special requirements:

All Bank Accounts

1. All bank accounts have a balance that is stored as an amount of pennies.

2. All money amounts are expressed in pennies.

3. All debit amounts will be subtracted from the balance, and all credit amounts will be added to the balance.

4. All bank accounts have a non-negative interest rate (0.02 would be a 2% interest rate).

5. When applying interest, interest amount is calculated by multiplying the balance by the interest rate.

6. When applying interest, interest amount is added to the balance.

7. Interest will not be applied to any account with a balance of zero.

8. Debit methods will return false if the transaction cannot be made because of insufficient balance or insufficient credit limit. Otherwise they will return true.

Savings accounts

1. A savings account cannot have a negative balance.

a. The debit method will return false if an attempt to overdraw the account is made.

2. The getAccoutInfoAsString method will return a string formatted like this:

Account type : Savings
Account # : 101101
Balance : 12345
Interest rate : 0.01

Checking accounts

1. Any CheckingAccount debit that ends with a negative balance will incur an overdraftFee (i.e. the overdraftFee amount will be subtracted from the balance)

2. The getAccoutInfoAsString method will return a string formatted like this:

Account type : Checking
Account # : 202202
Balance : 200000
Interest rate : 0.02
Overdraft fee : 2000

Creditcard accounts

1. The balance of a Creditcard account cannot overrun its credit limit

a. The debit method will return false if an attempt to overdraw the account is made.

2. Interest will not be applied to a Creditcard account with a positive balance.

3. . The getAccoutInfoAsString method will return a string formatted like this:

Account type : Creditcard
Account # : 303303
Balance : -27550
Interest rate : 0.03
Credit limit : 1000000

UML Class Diagram. see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.