Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: URGENT! Due in one hour. Please help!

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation URGENT! Due in one hour. Please help!

    So I thought my program was perfect until I tried to input "1.15" through this: Math.rint(amount*100)/100;

    It outputs as 1.14

    I don't get it. Other numbers work Please help, I don't know why is that.

    Thank you!


  2. #2
    Member GoodbyeWorld's Avatar
    Join Date
    Jul 2012
    Location
    Hidden command post deep within the bowels of a hidden bunker somewhere under a nondescrip building
    Posts
    161
    My Mood
    Stressed
    Thanks
    14
    Thanked 25 Times in 25 Posts

    Default Re: URGENT! Due in one hour. Please help!

    Might be rounding.

  3. #3
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: URGENT! Due in one hour. Please help!

    Improving the world one idiot at a time!

  4. #4
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: URGENT! Due in one hour. Please help!

    Quote Originally Posted by GoodbyeWorld View Post
    Might be rounding.


    Thanks for the reply, but could you be more specific please?

    --- Update ---

    Quote Originally Posted by Junky View Post
    Hello to you, too.

  5. #5
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: URGENT! Due in one hour. Please help!

    I would have been inclined to help you if you weren't rude by:

    Marking your post as urgent.
    Imposing a deadline upon us.
    Crossposting.
    Improving the world one idiot at a time!

  6. #6
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: URGENT! Due in one hour. Please help!

    I had a problem similar to this not long ago and I had to implement my numbers with the BigDecimal class... Basically it was a thing calculating money and it would give out very weird values when doing very simple math ( I recall 0.07 * 3 = 0.2100000000002 or something like that).

  7. #7
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: URGENT! Due in one hour. Please help!

    Quote Originally Posted by Junky View Post
    I would have been inclined to help you if you weren't rude by:

    Marking your post as urgent.
    Imposing a deadline upon us.
    Crossposting.
    I'm sorry to have come off as rude, I didnt mean to. I panicked and let my emotions take over me.

Similar Threads

  1. Rush hour game
    By zerocos in forum What's Wrong With My Code?
    Replies: 46
    Last Post: January 25th, 2013, 06:05 PM
  2. Help with Clock (advance and reverse day,hour,minute)
    By whyld4900 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 13th, 2011, 02:39 AM
  3. Array month/day/hour/min/sec incomplete java code
    By mightyking in forum Collections and Generics
    Replies: 12
    Last Post: September 18th, 2011, 08:46 PM
  4. Need urgent help regarding java word wrap function.. URGENT
    By coldice in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 16th, 2011, 05:43 AM
  5. Help please - urgent (Project due and not done) - Easy answer
    By Bagzli in forum Java Theory & Questions
    Replies: 1
    Last Post: March 2nd, 2011, 06:36 PM