We are a small store selling only the finest goods. Unfortunately, our goods are constantly degrading in quality as they approach their sellIn date.
We have a system in place that updates our inventory for us.
Your task is to add a new feature to our system so that we can begin selling a new category of items.
- All items have a
sellInvalue which denotes the number of days we have left to sell the item. This value decreases by 1 every timeupdate()is called. - All items have a
qualitythat decreases by 1 wheneverupdate()is called.
Pretty simple, right? Well, this is where it gets interesting:
- The
qualityof an item is never negative. - The
qualityof an item is never more than 50. - Once the
sellIntime has reached zero,qualitydegrades twice as fast every day. - "Diamond" has no
sellIntime and has a quality that does not change. - "Vintage Wine" increases in quality the older it gets, at the same rate as regular items.
- "Concert Tickets" increase in quality as its
sellInvalue decreases.- Its quality increases by 1 every day when the
sellIn > 10. - Its quality increases by 2 every day when the
sellIn <= 10 && sellIn > 5. - Its quality increases by 3 every day when the
sellIn <= 5. - Its quality drops to 0 after the concert.
- Its quality increases by 1 every day when the
Update our system to include "Chocolate Cake". This item degrades in quality twice as fast as normal items (-2, -4 if sellIn <= 0).