Skip to content

Assignment Submission: SCT 212 - 0216/2024#67

Open
Ranjos007 wants to merge 1 commit into
mulangonando:mainfrom
Ranjos007:main
Open

Assignment Submission: SCT 212 - 0216/2024#67
Ranjos007 wants to merge 1 commit into
mulangonando:mainfrom
Ranjos007:main

Conversation

@Ranjos007

Copy link
Copy Markdown

BaseTransaction.java — Converted from abstract to concrete class; implemented printTransactionDetails() and apply() (prints details only, does not modify balance).

DepositTrasaction.java — Added @OverRide on apply() to add deposit amount to account balance. Deposits are irreversible.

WithdrawalTransaction.java — Overrode apply() to subtract from balance with throws InsufficientFundsException. Added overloaded apply(ba, checkAvailable) using try-catch-finally for partial withdrawals. Implemented reverse() to restore original balance.

InsufficientFundsException.java (new) — Custom checked exception extending Exception, tracks shortfall amount.

Main.java — Added client test code for all three transaction types: successful operations, reversals, insufficient funds, partial withdrawals, and polymorphism via upcasting (late binding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant