Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language: MATLAB Shipping a package A parcel services company can ship a parcel only when the parcel meets the following constraints: - The parcel girth

image text in transcribed

image text in transcribed

image text in transcribed

Language: MATLAB

Shipping a package A parcel services company can ship a parcel only when the parcel meets the following constraints: - The parcel girth is less than or equal to 165 inches. - The parcel weighs less than or equal to 150lbs. The girth of a parcel is calculated as: Parcel Length +(2 Parcel Width )+(2 Parcel Height ) Write the function CanShip() to determine if an array of 4 parcels can be shipped. Function inputs: - parcelLengths - a 14 array containing 4 parcels' lengths in inches. - parcelHeights - a 1x4 array containing 4 parcels' heights in inches. - parcelWidths - a 14 array containing 4 parcels' widths in inches. - parcelWeights - a 14 array containing 4 parcels' weights in lbs. Function output: - parcelShip - a 14 logic array containing 1 's for parcels that are able to be shipped. Use element-wise arithmetic operations to calculate and store the parcels' girths in the variable parcelGirths. Use logical operators to then determine if the parcels meet the girth and weight requirements, and store the results in the variable parcelShip. Given parcelLengths =[96219] parcelWidths =[12101112] parcelHeights =[2199] parcelWeights =[55617047] then parcelGirths is parcelGirths = 37284261 parcelShip is determined to be parcelShip = 14 logical array 1101 Note that the third parcel has a weight of 170lbs, which is more than 150lbs, so the corresponding value in parcelShip is 0. \begin{tabular}{|l|l} 1 & % Define function CanShip \\ 2 & \\ 3 & % Calculate the parcel girths \\ 4 & % Determine parcelShip \\ 5 & \\ 6 & \\ 7 & \\ \hline \end{tabular} Code to call your function? C Reset

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data And Hadoop Fundamentals Tools And Techniques For Data Driven Success

Authors: Mayank Bhushan

2nd Edition

9355516665, 978-9355516664

More Books

Students also viewed these Databases questions