CashFlowPositive
This question is unfair towards anyone with a financial background as it assumes without stating that the unsold inventory from the shipment would be written down and expensed as part of the costs of goods sold for the purposes of this exercise, which is not obvious at all.
We can also do it without assuming any numbers:
Let original price of hat = x and total hats in shipment = y
Selling price of hat for 60% of hats = 1.5x
Selling price of hat for 28% of hats (Remaining 40% of hats * 70% of those were sold)= 2/3 of 1.5x= 0.5x
Revenue= 1.5x*0.6y + 0.5x*0.28y = 0.9xy + 0.14xy= 1.04xy
GP = 1.04xy -xy = 0.04xy
GP/Cost % = (0.04xy/xy)*100 = 4%
I think this method helped me avoid the trap of the suboptimal language of the question, which leaves it unclear if unsold inventory is expensed as loss or not.