Menu

Documentation

Martin Čakrt

Homework for Backend Developer position in BSC

Assignment

See this file. The bonus task was also implemented.

Compiling

The project was developed using Maven. Use Maven to compile.

Usage

The main class is called PackageDelivery. The command line options are:

Parameter Meaning Note
-file Path to file with the initial load of packages Optional. Multiple files can be specified. Each has to have its own -file entry
-fees Path to file with the definitions of the delivery fees Optional. Only one fee file can be specified. If omitted, the fees won't be displayed

Invalid input handling

If a file with the initial load of packages is missing/inaccessible/malformed, it's ignored. The same is true for the fees file.

Any extra spaces in the definitions are ignored. In case of values with set number of decimal places, any extra decimals are trimmed. Missing decimals are appended with zeroes.
All other problems in the input (such as malformed postal code, negative package weight etc.) cause and exception. If loading packages from a file, the whole file is ignored. If the wrong value was entered by user, an error is printed to the console.


MongoDB Logo MongoDB