Список покупок.
Привет :) Буду очень благодарен за помощь в реализации данной таски.
1. Application overview: Personal expenses management application that allows users to track how much money have they spent. 2. [MAJOR] Requirements: As a result of test problem solution you should provide a command-line application that supports following commands: ● add 2017-04-25 12 USD Jogurt — adds expense entry to the list of user expenses. Expenses for various dates could be added in any order. Command accepts following parameters: 2017-04-25 — is the date when expense occurred 12 — is an amount of money spent USD — the currency in which expense occurred Jogurt — is the name of product purchased ● list — shows the list of all expenses sorted by date ● clear 2017-04-25 — removes all expenses for specified date, where: 2017-04-25 — is the date for which all expenses should be removed ● total PLN — this command should take a list of exchange rates from http://fixer.io , calculate the total amount of money spent and present it to user in specified currency, where: PLN — is the currency in which total amount of expenses should be presented 3. [MINOR] Requirements: In order to get extra points for test problem solution you might cover your source code with unit tests. 4. Application usage example: Here is an example of normal application usage flow, for each command a corresponding output is shown: > add 2017-04-25 2 USD Jogurt 2017-04-25 Jogurt 2 USD >add 2017-04-25 3 EUR “French fries” 2017-04-25 Jogurt 2 USD French Fries 3 EUR > add 2017-04-27 4.75 EUR Beer 2017-04-25 Jogurt 2 USD French Fries 3 EUR 2017-04-27 Beer 4.75 EUR > add 2017-04-26 2.5 PLN Sweets 2017-04-25 Jogurt 2 USD French Fries 3 EUR 2017-04-26 Sweets 2.5 PLN 2017-04-27 Beer 4.75 EUR > list 2017-04-25 Jogurt 2 USD French Fries 3 EUR 2017-04-26 Sweets 2.5 PLN 2017-04-27 Beer 4.75 EUR > clear 2017-04-27 2017-04-25 Jogurt 2 USD French Fries 3 EUR 2017-04-26 Sweets 2.5 PLN > total EUR 5.42 EUR Мой код: class List { constructor(date, amount, currency, product){ this._date = date; this._amount = amount; this._currency = currency; this._product = product; } get data (){ return this._data; } get amount(){ return this._amount; } get currency (){ return this._currency; } get product (){ return this._product } } class Result extends List { constructor(date, amount, currency, product) { super(date); this._amount = amount; this._currency = currency; this._product = product; } } const out = new Result(2017-04-25, 12, 'USD', 'Jogurt'); console.log(Result) |
Часовой пояс GMT +3, время: 00:51. |