Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 3: Write a function called dawgexpress that calculates the cost of shipping a package according to the following price schedule: Type of Service Weight
Problem 3: Write a function called dawgexpress that calculates the cost of shipping a package according to the following price schedule: Type of Service Weight 0 0.5 lb 0.5-5 lb More than 5 lb $1.18 $0.42 for every additional $4.96 $0.72 for every additional lb Ground (5-7 days) $0.70+$ 0.06/oz 0.5 lb (or fraction or fraction) $4.40 +$1.20 for every additional $15.20 $1.80 for every additional Ib Express (3-4 days) $2.40 $0.25/oz 0.5 lb (or fraction) (or fraction) $18.60+$4.80 for every additional $61.80+$6.40 for every additional 1 Overnight (One day) $12.20 $0.80/oz 0.5 lb (or fraction) lb (or fraction) The program asks the user to select the type of service (Ground, Express or overnight). The program also asks the user to input the weight of the package. It first asks the user to input the number of pounds and then the number of ounces. Write you code such that it does the following and also outputs a similar output as below using fprintf statements. Cross check the validity of your results by doing sample hand calculations, eg. For a 3lb 100z shipping, you will pay $3.80 for ground, $11.90 for Express, and $48.60 for overnight. [Run the program with the following test case: Ground 3 Ib, 12 oz 20 Express 5 Ibs, 7 oz and 30 Overnight 8 Ibs, 11 oz. shipping Enter 1 for Ground Service, 2 for Express service and 3 for Overnight: 1 input the pounds component of the package: 8 input the ounce component of the package: 4 The cost to ship 8 pounds and 4 ounces using Ground service is $7.30
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started