The problem will be triggered when purchasing over $5000(Upgrade requirement). ================================================================================ Please input your Worker ID for logging in the system... 1 Please input your Member ID for logging in the system... 123 ---Welcome to Morx Supermarket--- ---To continue, please proceed your actions--- Input (1) for accessing Inventory System Input (2) for accessing Checkout System Input (3) for accessing Sales System Input (4) for accessing Membership System Input (5) for switching member Input (6) to exit 2 ---Welcome to Checkout System, aiden.--- Input commands for further management: Input (1) for Checkout Input (2) for refund Input (3) for exit 1 No Description Quantity Price($) 1 candies 10 300.0 2 Salt 60 1200.0 Please input (0) for proceed to checkout Please input (1) for remove products Please input (2) for modify quantities of products Please input (3) to cancel the checkout process 2 Please input which number of products customers would like to modify from their cart. 1 Please input the quantity that they would like to change. 200 Task Completed. Do you have any other actions to continue ? Please input (0) to exit Please input (1) to continue 0 No Description Quantity Price($) 1 candies 200 6000.0 2 Salt 60 1200.0 Please input (0) for proceed to checkout Please input (1) for remove products Please input (2) for modify quantities of products Please input (3) to cancel the checkout process 0 The total amount is: $6840.00 Please Input the amount of dollars that the customers paid 7000 Total changes is $160.00 The Order Reference Number is 2021-11-297 Input commands for further management: Input (1) for Checkout Input (2) for refund Input (3) for exit
The problem has been solved by adding a condition to help checking the upgrade progress and initiating upgrade membership. ================================================================================== public void upgradeMembership(Member member) { if (checkMembership(member)) { while (checkRemainingProgress(member) < 0) { if (member.getMembership() instanceof PlatinumMembership) { break; } else { member.setMembership(member.getMembership().upgradeMembership()); } } } } ================================================================================== Please input your Worker ID for logging in the system... 1 Please input your Member ID for logging in the system... 123 ---Welcome to Morx Supermarket--- ---To continue, please proceed your actions--- Input (1) for accessing Inventory System Input (2) for accessing Checkout System Input (3) for accessing Sales System Input (4) for accessing Membership System Input (5) for switching member Input (6) to exit 2 ---Welcome to Checkout System, aiden.--- Input commands for further management: Input (1) for Checkout Input (2) for refund Input (3) for exit 1 No Description Quantity Price($) 1 candies 10 300.0 2 Salt 60 1200.0 Please input (0) for proceed to checkout Please input (1) for remove products Please input (2) for modify quantities of products Please input (3) to cancel the checkout process 2 Please input which number of products customers would like to modify from their cart. 1 Please input the quantity that they would like to change. 200 Task Completed. Do you have any other actions to continue ? Please input (0) to exit Please input (1) to continue 0 No Description Quantity Price($) 1 candies 200 6000.0 2 Salt 60 1200.0 Please input (0) for proceed to checkout Please input (1) for remove products Please input (2) for modify quantities of products Please input (3) to cancel the checkout process 0 The total amount is: $6840.00 Please Input the amount of dollars that the customers paid 7000 Total changes is $160.00 The Order Reference Number is 2021-11-297 Input commands for further management: Input (1) for Checkout Input (2) for refund Input (3) for exit 3 Exiting... ---To continue, please proceed your actions--- Input (1) for accessing Inventory System Input (2) for accessing Checkout System Input (3) for accessing Sales System Input (4) for accessing Membership System Input (5) for switching member Input (6) to exit 4 ---Hi aiden, To check aero's membership details, please proceed your actions--- ---Input commands for further management--- Input (1) for checking the Customer Membership Status Input (2) for checking the Customer's points Input (3) for checking the status to another level of Membership Input (4) for exit 1 The customer owns a Gold Membership. ---Hi aiden, To check aero's membership details, please proceed your actions--- ---Input commands for further management--- Input (1) for checking the Customer Membership Status Input (2) for checking the Customer's points Input (3) for checking the status to another level of Membership Input (4) for exit