This Scala project calculates the price of a shopping basket with special offers. It accepts a list of items as input and outputs the subtotal, special offer discounts, and the final price.
Before you begin, ensure you have the following prerequisites installed on your system:
- Java Development Kit (JDK): Scala runs on the Java Virtual Machine (JVM), so you need Java installed.
- Scala
- SBT(Scala Build Tool)
Follow these steps to set up and run the project:
Clone this GitHub repository to your local machine using Git:
git clone https://github.com/ToghrulJabbarli/technical_assignment.git
Navigate to the project directory, create target folder for compiled files and compile the Scala source files using scalac
:
cd technical_assignment/src/main/scala
mkdir target
scalac -d target ShoppingBasket.scala PriceBasket.scala
You can run the program using the scala command. Make sure you are in the target directory:
scala PriceBasket "Item1" "Item2" "Item3"
Replace Item1, Item2, Item3 with items in baskets.
Open your terminal and navigate to the project directory. Start the Scala Build Tool (SBT) by entering the following command:
sbt test