Question: In Python create Program 3: Shipping Calculator Program 3: Shipping Calculator The Speedy Shipping Company will ship packages based on how much they weigh and

In Python create Program 3: Shipping Calculator

Program 3: Shipping Calculator

The Speedy Shipping Company will ship packages based on how much they weigh and how far they are being sent. They will only ship light packages up to 10 pounds. You have been tasked with writing a program that will help Speedy Shipping determine how much to charge per delivery.

The charges are based on each segment of 500 miles shipped. Shipping charges are not pro-rated; i.e., 600 miles is the same charge as 900 miles; i.e., 600 miles is counted as 2 segments of 500 miles.

Here is the table they gave you:

Package Weight Rate per 500 miles shipped

2 pounds or less $1.50

More than 2 but not more than 6 $3.75

More than 6 but not more than 10 $5.25

Your program should prompt the user for inputs (weight and miles), accept inputs from the keyboard, calculate the shipping charge, and produce accurate output.

Here are some test cases and expected output; the prompts are on the left side of the colons, and the user inputs are on the right side:

Test Case 1

Prompts / Inputs:

Please enter package weight in pounds: 1.5

Please enter number of miles to ship: 200 (This is one 500-mile segment.)

Expected result:

To ship a 1.5 pound package 200 miles, your shipping charge is $1.50.

Test Case 2

Prompts / Inputs:

Please enter package weight in pounds: 5.6

Please enter number of miles to ship: 1200 (This is three 500-mile segments.)

Expected result:

To ship a 5.6 pound package 1200 miles, your shipping charge is $11.25.

Test Case 3

Prompts / Inputs:

Please enter package weight in pounds: 1

Please enter number of miles to ship: 2500 (This is five 500-mile segments.)

Expected result:

To ship a 1.0 pound package 2500 miles, your shipping charge is $7.50.

Test Case 4

Prompts / Inputs:

Please enter package weight in pounds: 7.7

Please enter number of miles to ship: 12345 (This is twenty-five 500-mile segments)

Expected result:

To ship a 7.7 pound package 12345 miles, your shipping charge is $131.25.

Test Case 5

Prompt / Input:

Please enter package weight in pounds: 12.8

Expected result:

Sorry, we only ship packages of 10 pounds or less.

This program does not need any loops. The program will calculate one shipping charge and stop. That being said, if you would like, for extra credit, to implement a loop that allows the program to calculate multiple shipping charges based upon multiple inputs in a single execution, please feel free!

Helpful Hints:

  • You can use integer (floored) division. For example: 1200 // 500 = 2
  • Consider the implications of integer division on your segment calculation.
    • Look out for edge cases (Links to an external site.)!
  • Match the given prompts and output messages / formatting as closely as you are able.
    • Keep an eye on decimal places / think about types and conversions.

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!