Starting from:

$25

Assignment 01 – Inheritance and Polymorphism

You may work in pairs (that is, as a group of two) with a partner on this assignment if you wish or you may work alone. If you work with a partner, only submit one lab project with both of your names in the source code file to Blackboard (BB) for grading; you will each earn the same number of points. What to hand in, and by when, is discussed below. 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

 

 

 



 

 

What to turn in

For this assignment you must upload the following files to the Assignment 01 – Submission item in Blackboard by the specified due date.

 

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

More products