This repo contains the instructions and the data you need to complete the 9Spokes coding challenge. This challenge is not intended to be complex, but it is an opportunity for you to showcase your understanding and applying of good development practices.
You are encouraged to treat this as a real-life project. This typically means:
- Use version control effectively
- Include some basic documentation
- Include some unit tests
- Use a naming convention
You are free to use any programming language you'd like.
You are tasked with developing an application that performs the following tasks in sequence:
- Read and parse an external data file
data.json(located in this repo) - Using this data, calculate and print the values of 5 common accounting metrics:
- Revenue
- Expenses
- Gross Profit Margin
- Net Profit Margin
- Working Capital Ratio
- Commit your changes, and upload all your work to a feature branch of your choice.
- Begin by forking the current repository to your own
github.comaccount - Clone the repo locally
- Write your code, commit often
- Once you are satisfied with the output, push your changes to your
github.comaccount - Share the link
Use the formulas below to calculate your values:
This should be calculated by adding up all the values under total_value where the account_category field is set to revenue
This should be calculated by adding up all the values under total_value where the account_category field is set to expense
This is calculated in two steps: first by adding all the total_value fields where the account_type is set to sales and the value_type is set to debit; then dividing that by the revenue value calculated earlier to generate a percentage value.
This metric is calculated by subtracting the expenses value from the revenue value and dividing the remainder by revenue to calculate a percentage.
This is calculated dividing the assets by the liabilities creating a percentage value where assets are calculated by:
- adding the
total_valuefrom all records where theaccount_categoryis set toassets, thevalue_typeis set todebit, and theaccount_typeis one ofcurrent,bank, orcurrent_accounts_receivable - subtracting the
total_valuefrom all records where theaccount_categoryis set toassets, thevalue_typeis set tocredit, and theaccount_typeis one ofcurrent,bank, orcurrent_accounts_receivable
and liabilities are calculated by:
- adding the
total_valuefrom all records where theaccount_categoryis set toliability, thevalue_typeis set tocredit, and theaccount_typeis one ofcurrentorcurrent_accounts_payable - subtracting the
total_valuefrom all records where theaccount_categoryis set toliability, thevalue_typeis set todebit, and theaccount_typeis onecurrentorcurrent_accounts_payable
All currency figures must be formatted as follows:
- The value is prefixed with a
$sign - A comma is used to separate every 3 digits in the thousands, millions, billions, and trillions
- Cents are removed
All percentage values must be formatted to one decimal digit and be prefixed with a % sign. Don't forget to multiply by 100 each time you're tasked with calculating a percentage value.
Below is what a typical output should look like. Please note this is not the output of the challenge but a mere example.
$ ./myChallenge
Revenue: $519,169
Expenses: $411,664
Gross Profit Margin: 22%
Net Profit Margin: 21%
Working Capital Ratio: 95%
If your program requires a special way to compile or a specific version of a toolset, please be sure to include that in your running instructions.
Thank you and good luck!