The accumulated spending will get cleared when the membership upgrades. For example, when the customer spend 1050 and upgrades to silver membership the accumulated spending will 0 instead of 50(expected output). Steps to reproduce: 1.Create a new user instance 2.use add spending method to add 1050 3.use membership.getAccumulatedSpending() method 50 should be the expected output but 0 is observed
This issue is resolved by adding a new constructor Membership(String name, double discountRate, double upgradeThreshold,Membership previousMembership) so the previous spending will be carried over.