X610: Shipping Cost

Wilson’s Shipping Company charges the following rates:

Weight of Package

Rate per 500 Miles Shipped

2 pounds or less

$1.10

Over 2 lbs no more than 6 lbs

$2.20

Over 6 lbs no more than 10 lbs

$3.70

Over 10 lbs

$3.80

The shipping charges per 500 miles is not prorated. For example, if a 2 pound package is shipped 550 miles, the charges would be $2.20. Write code that calculates the shipping charge based on user input.

Examples:

shippingCharge(2, 550) -> 2.2

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.