Applicant: Carlo Cayos
Language: Go
There are two ways to build and run the application. Helper scripts were created for both options.
First is building the binary locally and storing it in bin
folder, this requires Go is installed locally.
Second is building a Docker image and running via Docker compose.
- Download and Install Go
- Run
local_build.sh
to build the application and save the binary inbin
- Run
local_start.sh
to run the application - Sample result below
- Install Docker and Docker Compose
- Run
docker_build.sh
to download the required Docker images and build the application - A Docker image is saved with tag
kogan_carlocayos
- Run
docker_start.sh
. This requires Docker Compose installed - Sample result below
The helper scripts use the default value conf/config.properties
and Air Conditioners
for category filter.
The program is configurable and accepts two arguments in this format:
myapp <config-file> <[OPTIONAL] category-filter>
config-file path to the config properties file. See conf/config.properties
category-filter [OPTIONAL] the product category filter to compute the average cubic weight. If not defined the default value is "Air Conditioners"
Example filtering products with specified category.
./bin/myapp conf/config.properties "Air Conditioners"
Average Cubic Weight of ALL Products under the Category "Air Conditioners" = 416133.85 kg
./bin/myapp conf/config.properties "Gadgets"
Average Cubic Weight of ALL Products under the Category "Gadgets" = 487.50 kg