Stockman: my favourite set of exercises to become fluent in a programming language.
- Read a CSV file into memory which contain sales invoice lines. Sample files can be found under
/tests/resources/
. - Pretty print the invoices.
Done.
$ git fetch --all --tags && git checkout tags/v1.3 -b v1.3 # checkout the tag
$ cmake -Bbuild -S. # bootstrap the build
$ cd build
$ cmake --build . # build stockman-c
$ ctest --test-dir tests -C Debug --output-on-failure # run the tests
$ src/stockman-c # run stockman-c
- Read a CSV file into memory which contain sales invoice lines.
- Find the total sales.
- Find the most expensive invoice and pretty print it.
- Find the most expensive product and print its code.
- Calculate the average price of each product, and print the the list of prices descendingly.
- Find the total sales per customer and print a descending list in the form "customer, total".
- Find the customer with the largest total sales.
- Find the 3 customers with the least total sales and print a descending list in the form "customer, total".
- Find the date with the largest total sales amount.
TBD
- Read a CSV file into memory which contains product inventory.
- Read a CSV file into memory which contain sales invoice lines.
- Check if the product referenced on each line has enough inventory.
- If no, do not import the invoice to which the line belongs.
- If yes, import the invoice line and update the inventory of the product accordingly.
- It is important to process the invoices in the order they appear in the CSV.
- Print a list of invoices listing the problematic line(s) for each invoice.
TBD
- Read a CSV file into memory which contains product inventory.
- Read a CSV file into memory which contain sales invoice lines, where each invoice has a timestamp denoting the transaction date and time.
- Check if the product referenced on each line has enough inventory.
- If no, do not import the invoice to which the line belongs.
- If yes, import the invoice line and update the inventory of the product accordingly.
- It is important to process any given invoice only once all the other invoices with earlier timestamps have been processed.
- Print a list of invoices listing the problematic line(s) for each invoice.
TBD
- Read a CSV file into memory which contains product inventory.
- Read two CSV files into memory, one containing sales invoice lines and the other purchase invoice lines. Each invoice has a timestamp which denotes the transaction date and time.
- Check if the product referenced on each sales invoice line has enough inventory.
- If no, do not import the sales invoice to which the line belongs.
- If yes, import the invoice line and update the inventory of the product accordingly.
- It is important to process any given invoice only once all the other invoices (sales and purchase) with earlier timestamps have been processed.
- Print a list of sales invoices listing the problematic line(s) for each invoice.
TBD
All files are under Apache License v2.0, unless otherwise specified.