Results 21 to 25 of 25
Thread: help
- 02-06-2011, 01:00 AM #21
Member
- Join Date
- Feb 2011
- Posts
- 17
- Rep Power
- 0
- 02-06-2011, 01:09 AM #22
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
No problem, glad you figured it out.
- 02-06-2011, 01:46 AM #23
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
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);
- 02-06-2011, 01:52 AM #24
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
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.
- 02-06-2011, 01:56 AM #25
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks