Let's define S to be the selling price, R to be the actual revenue achieved.
[eq1] R = S - 15%S (15% of the product cannot be sold, due to spoilage)
= S(100%-15%)
R = S*.85
[eq2] $1.58 + 20%R = R (our markup is 20% of realized sales*)
$1.58 = R(100%-20%) (subtract 20%R from both sides of [eq2])
$1.58/.80 = R (divide both sides by 80%)
$1.58/.80 = S*.85 (substitute into [eq1])
$1.58/(.80*.85) = S (divide both sides by .85)
$1.58/.68 = S
$2.32 = S
The price marked on the milk should be $2.32 per gallon to achieve the desired markup percentage.
_____
If you want to achieve a "profit" of 20% of the value of selling all 30 gallons, then the price needs to be somewhat higher. I compute it as $2.43.
Note, too, that 15% of 30 gallons is 4.5 gallons. Spoilage will not be exactly 15% in a given week, but may average that value over several weeks.
[eq1] R = S - 15%S (15% of the product cannot be sold, due to spoilage)
= S(100%-15%)
R = S*.85
[eq2] $1.58 + 20%R = R (our markup is 20% of realized sales*)
$1.58 = R(100%-20%) (subtract 20%R from both sides of [eq2])
$1.58/.80 = R (divide both sides by 80%)
$1.58/.80 = S*.85 (substitute into [eq1])
$1.58/(.80*.85) = S (divide both sides by .85)
$1.58/.68 = S
$2.32 = S
The price marked on the milk should be $2.32 per gallon to achieve the desired markup percentage.
_____
If you want to achieve a "profit" of 20% of the value of selling all 30 gallons, then the price needs to be somewhat higher. I compute it as $2.43.
Note, too, that 15% of 30 gallons is 4.5 gallons. Spoilage will not be exactly 15% in a given week, but may average that value over several weeks.