Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: help

  1. #21
    beta4 is offline Member
    Join Date
    Feb 2011
    Posts
    17
    Rep Power
    0

    Default

    i fixed it. thanks alot. you're a life-saver (everyone else too)

  2. #22
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    No problem, glad you figured it out.

  3. #23
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Ummm

    Just wondering, but what happens if you print out the value of that x?

    Java Code:
    int x = zipCode.charAt(0);
    [b]System.out.println("x="+ x); // expecting 3 or 9 or whatever[/b]
    
    if (x == 4)
        surCharge = (.05 * shippingCost);
    else if (x == 6)
        surCharge = (.09 * shippingCost);
    else if (x % 2 = 0)
        surCharge = (.02 * shippingCost);
    else
        surCharge = (.014 * shippingCost);

  4. #24
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    But wait! There's more!

    Additionally, if the zip code is even...

    In other words:

    (a) The 2% gets added as well as any other addition - not instead of as you are coding it.
    (b) It is based on whether the zip code is even which depends on the last digit of the zip code not the first one.

  5. #25
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Good catches pbrock, can't believe I didn't see them. Also, I noticed it says else add 14%, but .014 is 1.4%

Page 2 of 2 FirstFirst 12

Posting Permissions

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