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

ppData/Local/Temp/Temp 1-HW01 %20(1).zip/HWO 1-DrillProblems.pdf 415 Inputs: 1.

ID: 3874991 • Letter: P

Question

ppData/Local/Temp/Temp 1-HW01 %20(1).zip/HWO 1-DrillProblems.pdf 415 Inputs: 1. (double) Number of party attendees 2. (double) Number of pizzas ordered Outputs 1. (double) Slices of pizza per person 2. (double) Slices of pizza left over Function Description: You decide to host a party and buy some pizzas for you and your friends. But, in order to be fair, every person should get the same number of slices of pizza. Any extra slices will be left over and saved for later You could try and calculate the pizza slice distribution yourself, but why bother when you can have MATLAB do all the hard work! Given the number of people at the party and the number of pizzas ordered, write a functi should should receive, and how many slices of pizza will be left over on that outputs how many slices of pizza each person would get 3 slices, and 1 slice would be left over, so the first output would be 3 and the second output would be 1 Example pizzaParty(S, 2) 3, 1 Notes: Assume every pizza is cut into 8 slices. You cannot have fraction slices. Hints . You may find the floor() and/or modO) functions useful

Explanation / Answer

function [slice_per_p slice_left] = pizzaParty(attendees, pizzas) %calculates the number of pizza slices each attendee gets and the number of %slices of pizza left after each attendee gets their portion slice_per_p = floor((pizzas.*8)./attendees); slice_left = (pizzas.*8) - (slice_per_p.*attendees); end