Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assign deliveryCost with the cost (in dollars) to deliver a piece of baggage wei

ID: 3822175 • Letter: A

Question

Assign deliveryCost with the cost (in dollars) to deliver a piece of baggage weighing baggageWeight. The baggage delivery service charges twenty dollars for the first 50 pounds and one dollar for each additional pound. The baggage delivery service calculates delivery charge by rounding to the next pound. Assume baggageWeight is always greater than 50 pounds. If baggageWeight is 65.4 pounds, then the weight is rounded to 66 pounds and deliveryCost is 20 + (16 times 1) = 36 dollars function deliveryCost = CalculateDelivery (baggageWeight) % baggageWeight: Weight of baggage in pounds % Assign delivery cost with the delivery a piece of baggage weighing baggageWeight deliveryCost = 0; end

Explanation / Answer

function deliveryCost = CalculateDelivery(baggageWeight)
baggageWeight = ceil(baggageWeight);
deliveryCost = 20+(baggageWeight-50);
end