The function processOrder()
has a calculation to process orders. It has error codes for each restriction, including
if the quantity is non-positive, if the order is empty, if the product name is invalid, and if the quantity exceeds the maximum.
In this exercise, you will perform the refactoring Replace Nested Conditional with Guard Clause and then change the functionality.
Commit messages must be exactly as given in the instructions.
Instead of an upload to Brightspace, fill out this form. Note you can edit it later, so get as much of the form filled out as possible during class time.
refactor
of the original code.refactor
, perform a Replace Nested Conditional with Guard Clause Refactoring.As you make changes, build and run the test program often to ensure you are not changing the code's behavior.
Commit your changes with the commit message:
Push as soon as you make the commit.
main
main
.The customer wants to allow empty orders. Change the code, comments, and test to remove the error for an empty order.
Make sure the program builds and that all tests pass.
Use the following commit message exactly as given:
Push as soon as you make the commit.
refactor
refactor
.The customer wants to allow empty orders. Change the code, comments, and test to remove the error for an empty order.
Make sure the program builds and that all tests pass.
Use the following commit message exactly as given:
Push as soon as you make the commit.