I used this exercise as an opportunity to play with scala-cli (Scala's new default runner as of SIP-46) which seems like a perfect fit for this task. You can install it here: https://scala-cli.virtuslab.org/install/
scala-cli run src/ShoppingCart.scala -- apple apple orange apple
scala-cli test .