Shipping Charges
The Fast Freight Shipping Company charges the rates listed in the following table.
Weight of the Package (in kilograms) | Shipping Rate per Mile |
2 kg or less Over 2 kg, but not more than 6 kg Over 6 kg, but not more than 10 kg Over 10 kg, but not more than 20 kg | $0.01 $0,015 $0.02 $0,025 |
Create an application that allows the user to enter the weight of the package and the distance it is to be shipped, and then displays the charges.
Input validation Do not accept values of 0 or less for the weight of the package. Do not accept weights of more than 20 kg (this is the maximum weight the company will ship). Do not accept distances of less than 10 miles or more than 3000 miles. These are the company’s minimum and maximum shipping distances. Suggestion: use the OrElse button to combine the two range conditions that check for package weights that are too small or too large. Use exception handling to check for nonnumeric data.
Use the following test data to determine if the application is calculating properly:
Weight and Distance | Shipping Cost |
1.5 Kg, 100 miles 5 Kg, 200 miles 8 Kg, 750 miles 15 Kg, 2000 miles | $ 1.00 $ 3.00 $ 15.00 $ 50.00 |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.