Fast Freight Shipping

The fast freight Shipping company charges the rates the rates in

the following table.
Weight of the package(in kg) Shipping rate per mile
2 kg or less $0.01
over 2 kg, but not more than 6 kg $0.015
over 6kg, but not more than 10 kg $0.02
over 10 kg, but not more than 20 kg $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 or else operator to combine the two range

conditions that check 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 $1.00
5 kg,200 miles $3.00
8 kg, 750 miles $15.00

×
New Download