Skip to content

AlexOcanoaia/Bank_App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Banking System

I implemented and designed a banking system in Java. In this project, i have created 10 packages: account, alias, card, command, exchangeRates, information, outputCommands, transaction, user, commerciant.

Features of the program

  • a user can have multiple types of an account (classic, saving, business);
  • a user can have an one time card;
  • transfers between 2 accounts are available;
  • a user can set an alias to another account;
  • a user can exchange money;
  • payment to a commerciant is possible;
  • the payments can have commissions and cashbacks;

Design Patterns Used

  1. Command Pattern

    I used this pattern for making the commands.

  2. Factory Pattern

    I used this pattern to build each command. I implemented with a switch where i assign the parameters for each command.

    Is implemented in public Command getCommand function.

  3. Singleton Pattern

    I used this pattern for many classes. One of the classes is ArrayUser. I implemented the ArrayUser class with Singleton because i want to have access to the user globally. Each class can access the information about users.

  4. Visitor Pattern

    I used this pattern for the printUser command (for writing information about users, accounts and cards).

    This pattern is find in information package.

  5. Strategy Pattern

    I used this pattern for implementing the cashback. It is find in commerciant package(CashbackMethod class).

Description of the program

In the account package I implemented the account classes (Classic account, Saving account and Business Account).

In the alias package I implemented two classes: Alias and AliasSingleton. In Alias class i have two fields: name (represent the name of the alias) and account (the account that correspond to the alias). I created a Singleton for alias because the every alias is global and needs to be available for any user.

In the card package I implemented the card classes (Classic card and one time card). In this classes i have a variable (oneTime) that shows if the card is classic or not. (oneTime = 0 if the card is classic, otherwise is equal with 1).

In the command package I implemented the commands. I created an interface (Command) with one method (execute). For every command i created a class that override the method execute. I used the Factory design pattern for building the commands.

In the exchangeRates package I implemented the exchange rates. I use a graph for converting the currency. The ExchangeRates class is a Singleton because i build the graph in the Main class and i need the graph to be global. For calculating the new amount i use a recursive dfs algorithm (i added each rate in a list). In the calculateSum method i return the new amount (if the convert is possible, otherwise the method returns -1).

In the outputCommnands package I implemented the output for the commands. I created an interface that contains: an ObjectMapper (MAP), a method show and a default method (build every output for transaction). The method show in every class represent the output of the command.

In the transaction package I implemented one class (Transaction). This class has fields for every command. To add a transaction I use setters from this class.

In the user package I implemented 2 classes: User and ArrayUser. User class contain 5 fields: 2 ArrayLists (one for the accounts that the user have and one for the transaction history), and 3 Strings that represent the information about the user. The ArrayUser class is a Singleton. I choose to make that class a Singleton because i needed access the informations about users in the commands classes.

In the commeciant package I implemented a Singleton that have information about the commerciants and cashback. For cashback, I used Strategy Pattern (I created an interface CashbackStrategy with the function that calculates the cashback amount calculateCashback).

In the information package I implemented the Visitor Pattern for printUsers. I created 2 interfaces (one for visit methods and one for accept method). I created a class Information that implements the visit methods.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors