• Post Reply Bookmark Topic Watch Topic
  • New Topic

Shipping Charge Calculator  RSS feed

 
Rithanya Laxmi
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to write a Utility to calculate the shipping charges based on the product weight in pounds and distance in miles. Please let me know how we can go about it.

Thanks
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your business logic/requirement to decide the shipping charges? There should be some formula or some kind of case statements saying if productWeight > X and distance > Y then shippingCharge = Z.
 
Rithanya Laxmi
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mohammad.

The assignment has the following rates:

Weight of Package Rate per 500 miles shipped
-------------------- --------------------------------
2 pounds or less $1.10
over 2 pounds but not more than 6 pounds $2.20
over 6 pounds but not more than 10 pounds $3.70
over 10 pounds $3.80

The shipping charge per 500 miles are not prorated. For example, if a 2 pound package is shipped 502 miles, the charge would be $2.20. Please let me know your thoughts.

Thanks.
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far? What do you have a problem with?
Please, read those pages: ShowSomeEffort and NotACodeMill.
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rithanya Laxmi wrote:

Weight of Package Rate per 500 miles shipped
-------------------- --------------------------------
2 pounds or less $1.10
over 2 pounds but not more than 6 pounds $2.20
over 6 pounds but not more than 10 pounds $3.70
over 10 pounds $3.80

The shipping charge per 500 miles are not prorated. For example, if a 2 pound package is shipped 502 miles, the charge would be $2.20. Please let me know your thoughts.



umm it appears to be having some conditions as rules. How do we use conditions in java ?? Find that and you're good to start
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shubham Semwal wrote:umm it appears to be having some conditions as rules. How do we use conditions in java ?? Find that and you're good to start

Nope, that's not a good approach. OP needs first to figure out what algorithm to use. Only when he figures it out, he should wonder how to write it in Java.
Read this: WhatNotHow
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!