Adds a getDiscountedPrice and fixes junit tests

Because many cans in a child composite would calculate its own discount before handing off its total price to the parent composite, discounts were being applied multiple times in some cases. To work around this, I put the applying of discounts into a separate method, getDiscountedPrice, which calls getPrice (which now returns a total price before discounts are applied) and applies the discounts to this value.
This commit also updates the Junit tests to use the getDiscountedPrice method.
As well, an error in which a composite was added as a child of itself is fixed.