Question: In C using (printf and scanf) Write a program to ask the user for the weight of a package, and display the shipping charges for

In C using (printf and scanf)

Write a program to ask the user for the weight of a package, and display the shipping charges for the package. If the weight of the package is less than or equal to 0 pounds, inform the user and exit the program. The shipping charges are:

Weight of Package Shipping Charge
2 pounds or less $1.25
Over 2 pounds but not more than 6 pounds $2.50
Over 6 pounds but not more than 10 pounds $3.90
Over 10 pounds $4.40

Create constants for the cutoff values of 2.0, 6.0, and 10.0, the value of 0.0, and for the 4 shipping charges.

Example Run #1: (bold type is what is entered by the user)

Enter the weight of the package: 2.0

The shipping charge is $x.xx.

Example Run #2:

Enter the weight of the package: 0 The weight of the package must be greater than 0.00.

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!