Question
Question: Shipping Charges The Fast Freight Shipping Company charges the following rates: Weight of Package Rate per 500 miles Shipped 2 pounds or less $1.10
Question: Shipping Charges
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. For example, if a 2.5-pound package shipped 550 miles, the charges would be $4.40.
Write a program to ask the weight of the package, the number of miles shipped, then calculate and display the shipping charges.
For example:
Weight 1.7 pounds, miles 430 miles, charges: 1.10
Weight 1.7 pounds, miles 775 miles, 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, charges: 3.30 (1.10 * 3).
Weight 8 pounds, miles 6290 miles, charges: 3.70 * 13 = 39.10
Problem analysis:
2 input: the weight, the miles
Weight: double, miles: double
Based on the weight, you check which shipping rate you use in the calculation
You can use a if-else if to check the weight
You also need to figure out how many 500 miles the shipping distance has. Sometimes you need to round it up to the next integer, sometime not.
Requirements: pseudocode and flowchart
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