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; endExplanation / Answer
function deliveryCost = CalculateDelivery(baggageWeight)
baggageWeight = ceil(baggageWeight);
deliveryCost = 20+(baggageWeight-50);
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.