Question: PROBLEM 2 Problem Statement Develop a well - documented function called shipping cost that calculates the cost of shipping a package based on the package

PROBLEM 2
Problem Statement
Develop a well-documented function called shipping cost that calculates the cost of shipping a package based on the package weight and type of service according to the price schedule listed in Table 1. Your function should be saved in a file called shippingcost. m.
Program Requirements
The function should have two input arguments, in this order: the weight of the package and a numerical value indicating the desired shipping service: 1= ground, 2= second day, and 3= overnight.
The function should return two values, in this order: a number indicating success (1) or failure (0) and the cost of shipping the package. For example, when computing the cost of shipping a 1 lb package by ground service, the return values would be 1 and 5.5. If the input values are invalid, or the type of service is not available for a package with the given weight, the function should return 0 and 0.
If a weight larger than 70lb is entered for ground service, the function should return 0 and 0.
If a weight larger than 40lb is entered for 2nd day service, the function should return 0 and 0.
If a weight larger than 10lb is entered for overnight service, the function should return 0 and 0.
Hints: Consider using the cei 1 function in your cost calculation to round-up the weight.
Table 1. Shipping Cost Schedule
\table[[\table[[Shipping],[Service]],Package Weight],[0-2lb,2-10lb,Greater than 10lb
 PROBLEM 2 Problem Statement Develop a well-documented function called shipping cost

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!