- This project demonstrates a BankApplication using Java.
- This Application provides functionalities such as deposit, withdraw, check balance, previous transaction.
- The BankAccountInterface interface is a contract and declares showMenu method.
- BankAccount class implements BankAccountInterface and defines the above method along with deposit, withdraw, check balance, previousTransaction methods.
- Here I have used Getters and Setters for variables customerName, customerID, balance, previousTransaction as a layer of encapsulation
- The encapsulation is provided thinking in future the value of customerIDs or balance(if interest is added with balance) may change.
- I have used Factory method pattern to create objects of BankAccount. This avoids the direct use of BankAccount constructor. This also helps in validation of input and establishing connection between publisher and ubscriber for Observer pattern.
- I have used Observer pattern, here the observer interface listens to the changes in class BankAccount and sends notifications whenever deposit/withdrawal is made.
- The subscriber is an abstract class, it is extended by EmailSubscriber and SmsSubscriber to have their own definition of display method which is an abstract method in Subscriber class.
- BankAccountFactory setInput method generates the BankAccount object only if customerName, customerID, amount, notificationType is not empty.
- Finally in the main class BankApplication, I create an object of BankAccountFactory and use method setinput(customerName, customerID, amount, notificationType)
- The setInput method returns an object of BankAccount.
- Here the user does not care about the implmentation of BankAccount, he is only concerned about using methods declared in interface.
- Testing: I have used JUnit Testing to test deposit, withdrawal, checkBalance, previousTransaction methods of BankAccount class.
-
Notifications
You must be signed in to change notification settings - Fork 1
vishwanathdc/BankApplication
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Bank Application in Java with Factory and Observer pattern, interface, encapsulation and abstraction
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published