Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
As stated out earlier I tried to solve it using an object oriented approach by wrapping a special object around the item class.
Inside that special object I implemented the different rules for the cases. In some cases (only when it's tested against the random test cases) it fails
to modify the sellin and qualtity values.
I changed the whole code and used simple if-else statements for each case. This solutions works like a charm.
Haven't figured out yet what's the problem. Maybe it's because I create new objects and inject the item class into them.
Yes, I used console.log (System.out.println, because I solve it in Java). I could not find anything suspicious inside the code.
Because I solved it anyway I don't waste much time thinking about what went wrong.
Thanks again for answering.
Can someone point out the mistake I had in my object oriented solution? It fails the random tests,
while the last solution passes everything with waved flags.
I've put all the parts from the last one into the object oriented attempt and it still fails.
I'm a bit confused and would be thankful for some clarification.
My apologies. Then I got it wrong.
I'll just leave it as it is and keep my experience boost with it. ;-)
Thanks for the fast reply! Have a nice day.
Maybe I get this wrong, but as stated in the instructions the quality of an item can't be greater than 50.
In your random tests though the following test case failed:
test_randomItems(ShopInventoryManagerTests)
Testing 11 random items after 8 days.
Testing: +5 Conjured Vest of Hoggie
Testing: +15 Aged brie Sword of Sargaras
✘ Expected different value expected:<72> but was:<50>
I had this a couple of times and double (and triple) checked all the cases.
I passed due to a lucky random test case scenario.
Can you please check my solution if I made a mistake and passed by accident?
Greets
David
I should take more effort in learning Java Streams.. Good job!
Clever solution as it solves the problem in one line.
People actually reading the code won't get the algorithm at first, because there are many magic numbers used.