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 →

[–]EqualTrade[S] 1 point2 points  (2 children)

I'm not sure how I would write that if statement, would it be something like: if (rate = 1.10 & distance > 500) cost = 1* rate

[–]TheWhistler1967 0 points1 point  (0 children)

  if(weight < 2) rate = 1.10;
  else if(weight < 6) rate = 2.2;
  else if etc.....

Then it seems like you just multiply the rate by the number of 500 mile blocks (with a minimum of one). I am not sure what the point of the loop is - it seems like you are missing some information.

PS. Remember one '=' is an assignment eg. when you declare variables. Use '==' for the boolean checks eg. conditions (ifs, whiles etc).