The price is calculated as the maximum value between the price calculated using the markup (cost markup) and the price calculated using the markdown (cost markdown). This ensures that the price is at least equal to the cost price.
The roundTwoDecimal function is applied to both the markup and the markdown prices to ensure they are rounded to two decimal places.
The Math.max function is used to select the higher of the two prices calculated using markup and markdown.
This modification allows for selling the product below the cost price if markdown is set appropriately.
The price is calculated as the maximum value between the price calculated using the markup (cost markup) and the price calculated using the markdown (cost markdown). This ensures that the price is at least equal to the cost price.
The roundTwoDecimal function is applied to both the markup and the markdown prices to ensure they are rounded to two decimal places.
The Math.max function is used to select the higher of the two prices calculated using markup and markdown. This modification allows for selling the product below the cost price if markdown is set appropriately.