Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/9elements/academy-exercise-es-6-classes
In this tutorial you'll learn how to use ES6 classes using Babel and webpack.
https://github.com/9elements/academy-exercise-es-6-classes
Last synced: 6 days ago
JSON representation
In this tutorial you'll learn how to use ES6 classes using Babel and webpack.
- Host: GitHub
- URL: https://github.com/9elements/academy-exercise-es-6-classes
- Owner: 9elements
- License: mit
- Created: 2016-09-02T16:08:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T23:16:43.000Z (almost 2 years ago)
- Last Synced: 2024-04-11T03:52:05.899Z (7 months ago)
- Language: JavaScript
- Size: 2.08 MB
- Stars: 3
- Watchers: 15
- Forks: 2
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# User Stories
- In a bank you have business accounts and private accounts.
- You can transfer money between accounts using transactions.
- For private accounts the transaction fee is 0.01 € for business accounts the transaction fee is 0.02 €.# Tasks
- [ ] write an `Account` class
- [ ] The class should hold a reference to the `ledger`
- [ ] It should also have a `name` to identify the account
- [ ] implement a `Transaction` class
- [ ] A transaction consists of an optional `sender` (Type: Account)
- [ ] `receiver` (Type: Account)
- [ ] `amount` (Type: Number)
- [ ] `reference` (Type: String)
- [ ] implement a `Ledger` class that keeps all transactions
- [ ] It should keep an array of `transactions`
- [ ] Have a member variable `bankAccount` the keeps a reference for the bank account
- [ ] Implement a function `addTransaction(transaction)`
- [ ] Implement a function `calculateAmountForAccount(account)` using `reduce`
- [ ] Implement a function `findTransactionsForAccount(account)` using `filter`
- [ ] Add convenience functions to `Account`
- [ ] add a `send` function that generates two transactions
- [ ] The actual transaction
- [ ] A transaction for the fee for the bank
- [ ] add a getter to calculate the `amount`
- [ ] add a getter to retrieve all `transactions` that are related to the account
- [ ] specialize `Account` class into a `BusinessAccount`
- [ ] override the `send` function to respect different transaction fees for businesses# Help
You can see the tests in `integration-test`. Try to run write the classes so they are satisfying the tests. You can also follow the commits in the `solution` branch to see the solution.
# Commands
```
npm install # install all dependencies
npm test # runs all tests
npm start # starts a dev server on localhost:8000
```