Profit Margin Calculator Soup

Profit Margin Calculator (Soup)

Calculate the profit margin for your soup business.

function calculateProfitMargin() { const costOfGoods = parseFloat(document.getElementById(“costOfGoods”).value); const sellingPrice = parseFloat(document.getElementById(“sellingPrice”).value); if (isNaN(costOfGoods) || isNaN(sellingPrice) || costOfGoods <= 0 || sellingPrice <= 0) { alert("Please enter valid positive values for both fields."); return; } const profitMargin = ((sellingPrice – costOfGoods) / sellingPrice) * 100; document.getElementById("profitMarginResult").value = profitMargin.toFixed(2) + "%"; }

Leave a Reply

Your email address will not be published. Required fields are marked *