CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Nov 2011
    Posts
    4

    output for calculating shipping

    Hi I have been at this for hours and cannot understand why the shipping keeps outputting the same amount no matter which weight I enter. It is supposed to calculate the shipping based on the weight and there are three different options like if it is over 45 pounds it will be a different amount. Can anyone tell me what I need to fix?
    Code:
    float CalcShip(int &totalAt)
    {
     float ship;
     ship=0.00;
        if (totalAt <= 15)
      {
       ship= 8.00;
      }
      else if (totalAt <= 40)
      {
        ship= (totalAt - 15) *.1 + 8.00;
      }
      else if (totalAt > 50)
      {
        ship= (totalAt - 45) *.07 + 8.00;
      }
     return (ship);
    }
    Last edited by lva28; Tod
    Last edited by solar23; December 1st, 2011 at 10:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured