• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

HELP ME PLEASE!!!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing a project for school about shipping rates i need to make a program that will ask the user to enter a weight of a package and the amount of miles they want to ship it.. the rates per 500 miles are as follows:
2lbs or less 1.10
over 2 lbs but not more than 6lbs 2.20
6lbs but not more than 10 lbs 3.70
over 10 lbs is 3.80

I am having a hard time trying to figure out what i need to put in my code to have any package being sent under 500 miles get set to the minimum shipping rate listed above or is there a different way i should be setting this up??.. can someone please explain to me what i need to do i would greatly appreciate it.. Here is what i have so far:
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems you're using the "distance" value incorrectly. A check for "distance < 500" doesn't make sense if earlier you defined "distance = miles / 500".

But since -in the format statement- you're multiplying by the distance value anyway, you should ask yourself: How do you need to take the distance value into account in those "if" statements?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch. Please use a meaningful subject line instead something like "HELP ME PLEASE" when you post a topic.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure you let everyone know about the cross threads.

http://forums.sun.com/thread.jspa?threadID=5375236&tstart=15

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed, please BeForthrightWhenCrossPostingToOtherSites. It's the polite thing to do.
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic