6. The parking hours to be used by three people at Vancouver Airport over 10 day
ID: 3880025 • Letter: 6
Question
6. The parking hours to be used by three people at Vancouver Airport over 10 days are given below. 4.0 1.5 6.0 0.75 12.0 72.0 0.0 0.0 4.0 2.75 48.0 0.0 5.5 1.00 3.00 2.00 1.5 2.5 4.0 1.5 1.0 1.5 5.0 8.01.5 2.0 1.5 1.75 12.0 2.0 The rate structure for parking is: Short-term parking: First 30 minutes $2.50 and each additional 15 minutes or fraction thereof is S 1.00. Daily maximum is $ 25.00 Long-term parking: First 3 hours $ 10.00 and each additional hour or fraction thereof is $3.00. Daily maximum is $ 18.00. Weekly maximum is $ 80.00 Write a MATLAB code to decide which parking lot (short-term or long-term) should be used each time to minimize the cost and calculate the total minimum parking bill over the 10 days for each person. (30 marks) 28Explanation / Answer
Here is the solution, do give me a thumbs uo if this helps!
p1=[4 1.5 6 0.75 12 72 0 0 4 2.75];
p2=[48 0 5.5 1 3 2 1.5 2.5 4 1.5];
p3=[1 1.5 5 8 1.5 2 1.5 1.75 12 2];
for i=1:10
if p1(i)>0.5
p1s=2.5
p1s+=ceil(p1(i)-0.5);
end
if p2(i)>0.5
p2s=2.5
p2s+=ceil(p2(i)-0.5);
end
if p3(i)>0.5
p3s=2.5
p3s+=ceil(p3(i)-0.5);
end
if p1(i)>3
p1l=10
p1l+=ceil(p1(i)-3)*3;
end
if p2(i)>3
p2l=10
p2l+=ceil(p2(i)-3)*3;
end
if p3(i)>3
p3l=10
p3l+=ceil(p3(i)-3)*3;
end
end
The code computes the cost using both long term and short term. They can be used to compare and thus compute the min value.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.