The Fast freight shipping company charges the rates listed in the following tabl
ID: 3560427 • Letter: T
Question
The Fast freight shipping company charges the rates listed in the following table: Weight of the Package (in kgs) Shipping Rate per Mile 2kg or less $0.01 Over 2kg, but not more than 6kg $0.015 over 6kg, but not more than 10kg $0.02 over 10kg, but not more than 20kg $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.
Write answer as a psuedocode
Assume names is an Integer array with 20 elements. Design a FOR loop that displays each element of the array.
Write answer as a psuedocode
Explanation / Answer
Enter package weight : scan
Weight <- scan
Enter shipping distance : scan
distance <- scan
cost <- 0
if(weight between 0 and 2kg)
cost = distance * 0.01
else if(weight between 2 and 6kg)
cost = distance * 0.015
else if(weight between 6 and 10kg)
cost = distance * 0.02
else if(weight between 10 and 20kg)
cost = distance * 0.025
else
print "Invalid weight or distance"
print cost
---------
Second
---------
for (i=0;i<20;i++) you can replace i<20 by i<names.length
print names[i]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.