|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (5 bit)
Join Date: Aug 2002
Posts: 24
|
Java Help please
Hi
Well I have another Java question I have to write some code that will calculate the shipping cost. here is the problem A binder weighs 1 pound 5 ounces, An empty shipping carton weighs 1 pound 9 ounces and can hold up to 12 binders. The shipping costs include $1.44 for each full or partial carton plus $0.96 per pound or fraction of a pound( so anything even .1 over a lb is another 96 cents) plus a $3.00 service charge. ( only charged once) I have this private double calculateCost(int binders) { double cartons, pound, shipping; now I have to start calculating, kinda lost. Any thoughts thanks? |
|
|
|
|
|
#2 |
|
Professional gadfly
|
That's not a Java problem, that's a math problem.
![]() You need to find an algorithm to calculate the cost. What I would suggest is to sit down and think about the relevant questions: How would you calculate how many full cartons you need for X amount of binders? How would you calculate the weight of the binders? What do you do with the leftovers? Once you figure these things out and have a good mathematical answer, putting it into Java will be very simple. |
|
|
|
|
|
#3 |
|
Member (9 bit)
Join Date: Jul 2003
Posts: 288
|
What about packing material?
It might be best to develop some standards. You may want to have alternate shipping containers instead of one size fits all. For instance you could ship a single binder in a Fed Express Bag. A set fee for shipping one item may be a better way of handling this. If you ship enough items, you may get to a point where the cost to ship one item is so minimal that it could have a reduced price or be free. Also there are different ways to ship like 2nd day air, and shipping saver fares with a 5-10 day delivery. |
|
|
|
|
|
#4 | |
|
Professional gadfly
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|