Legal-Dan / bank_tech_test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bank Tech Test

Requirements

You should be able to interact with your code via a REPL like IRB or the JavaScript console. (You don't need to implement a command line interface that takes input from STDIN.)
Deposits, withdrawal.
Account statement (date, amount, balance) printing.
Data can be kept in memory (it doesn't need to be stored to a database or anything).

Acceptance Criteria

Given a client makes a deposit of 1000 on 10-01-2023
And a deposit of 2000 on 13-01-2023
And a withdrawal of 500 on 14-01-2023
When she prints her bank statement
Then she would see

14/01/2023 || || 500.00 || 2500.00  
13/01/2023 || 2000.00 || || 3000.00  
10/01/2023 || 1000.00 || || 1000.00

Installation and Testing

To run RuboCop and SimpleCov navigate to the bank_tech_test folder on your local drive in terminal and run

bundler

There are not installation requirements for the main application outside of having a version of Ruby installed. To run the tests navigate to the bank_tech_test folder on your local drive in terminal and run

rspec

To run the application follow the usage instructions below.

Approach

My approach to this application was to focus on making something that could easily be extended and further developed in order to be utilysed in an industry setting. By keeping an array of hashes it would be straightforward to add in further details regarding the transaction. Keeping each account as a seperate instantiation of the class also opens up the possibility to add in further account details (customer name, account number, etc.) into the class initialize method for easy reference.

Usage

require './lib/bank'

# to instantiate the BankAccount class
account_name = BankAccount.new

# document a deposit into the account
account_name.deposit(100)

# document a deposit into the account
account_name.withdraw(100)

# print to screen the statement for this account
puts(account_name.print_statement)

Example Usage

Screenshot 2021-10-25 at 16 10 52

Further Testing

Tested with RSpec
Style checked with RuboCop
Testing coverage monitored using SimpleCov

About


Languages

Language:HTML 82.3%Language:Ruby 17.7%