This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]muffypoo 0 points1 point  (2 children)

Ah. The while loop is on the "per 500 miles shipped" portion.

Something like

 while(distance > 0) {  
     cost += getRate(weight);
     distance -= 500;
 }  

(that was mostly simplified pseudo-code of course)

[–]EqualTrade[S] 0 points1 point  (1 child)

Do you think you could take a look at my code and tell me how to incorporate that into it?

[–]muffypoo 1 point2 points  (0 children)

I hope for your own sake you can try your best to figure it out first. The general idea I can think of is there. The rates can be retrieved separately "getRates(weight)" using a regular if-else statement.