LANGUAGE IS PYTHON!!! PLEASE HELP

The Fast Freight Shipping Company charges the following rates:

Weight of Package

Rate per 500 miles Shipped

2 pounds or less

$1.10

Over 2 pounds but not more than 6 pounds

$2.20

Over 6 pounds but not more than 10 pounds

$3.70

Over 10 pounds

$3.80



The shipping charges per 500 miles are not prorated, which means that we don't divide the shipping charges in the above table by 500 to get the shipping charge per mile. For example, if a 2.5-pound package shipped 550 miles, the charges would be $4.40.

Design an algorithm and write a Python program to ask the user to enter the weight of the package, the number of miles shipped, then calculate and display the shipping charges.

Assignment Example:
Weight 1.7 pounds, miles 430 miles, total shipping charges: 1.10
Weight 1.7 pounds, miles 775 miles, total shipping charges: 2.20 ( 1.10 * 2). The key point here is how to get the 2 in the multiplication
Weight 1.7 pounds, miles 1234 miles, total shipping charges: 3.30 (1.10 * 3).
Weight 8 pounds, miles 6290 miles, total shipping charges: 3.70 * 13 = 48.10
Problem Analysis:
2 input: the weight, the miles (both could be decimal values)
Based on the weight, you can use a if-else if decision structure to check which shipping rate you use in the calculation (use the shipping rate in the table)
based on the miles the packages shipped, you calculate how many 500 miles the package is shipped. It determines the number times the shipping rate need to multiple. Sometimes you need to round it up to the next integer, sometime not. You need to figure out when the miles/500 should be rounded up to the next integer, and when it should not.
The program will display the total shipping charges for the package.

Respuesta :

fichoh

The required program written in python 3 is displayed below :

weight = eval(input())

#prompts user to enter weight value

miles = eval(input())

#prompts user to enter number of miles

if miles <= 500:

#shipping calculation for miles value below 500 miles

if weight <=2 :

shipping_charge = 1.10

elif(weight>2)and(weight<=6):

shipping_charge = 2.20

elif(weight>6)and(weight<=10):

shipping_charge = 3.70

elif(weight>10):

shipping_charge=3.80

#shipping charge for each weight category

else:

#shipping cost if the miles value entered is above 500 miles

if weight <=2 :

shipping_charge = 1.10 * round(miles/500)

#number of miles divided by 500 is rounded to the nearest whole number and multiplied by the 500 Mile charge

elif(weight>2)and(weight<=6):

shipping_charge = 2.20 * round(miles/500)

elif(weight>6)and(weight<=10):

shipping_charge = 3.70 * round(miles/500)

elif(weight>10):

shipping_charge=3.80 * round(miles/500)

print('Your total shipping charge is :

ACCESS MORE
,shipping_charge)

# displays the total shipping charge to be paid based on the inputted values.

Learn more :https://brainly.com/question/25122309

Ver imagen fichoh
ACCESS MORE