The App accepts fruit names as command line arguments. As specified by the exercise description accepted fruit names are:
Apple, Banana, Melon and Lime. Adding any other other fruit to the basket will cause IllegalArgumentException.
If no arguments are passed basket remains empty and a total cost £0.00 is calculated.
Content of the basket as well as calculated total cost is printed to the system console.
- prices are defined in pennies and
inttype capacity is sufficient to store them intcapacity is sufficient as well for the total cost of a basket in pennies- fruit names are case sensitive
To run tests execute command ./gradlew test
To build the app execute command ./gradlew build
To run the app, after building it:
- go to folder
<project-root>/build/distributions/ - unzip
fruit-basket.zip - go to subfolder
fruit-basket/bin - run
./fruit-basket <fruit-name-1> <fruit-name-2> ... <fruit-name-n>
Alternatively app can be run under IDE via FruitBasketApp class.
Java 8 (build 1.8.0_31-b13). Gradle 3.5 (wrapper included).