Results 1 to 5 of 5
  1. #1
    EBITON5 is offline Member
    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Unhappy Please help - calc percent in java

    Hi ,
    Please help me with this problem :
    I whoul like to change the precent from *1.17 (17%) to calc of precent like this :
    3% + 5% + 5$

    For example :

    The resault is 10$ - i want to get :

    10$ +3%(0.3$) + 0.5% (0.51$) + 5$ = 15.81$

    How i change this line to this calc
    if(results[i].getSite()=='Xxx'&&XPrice==0)
    {
    XPrice =(results[i].getPrice() *1.17);
    }
    }


    Please help me with this is very iportant to me

    Thank you so much !

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,910
    Rep Power
    5

    Default Re: Please help - calc percent in java

    First, check your percentages. 3% is 3/100 or .03 and 5% is 5/100 or .05. It sounds like you want 17% of 10 to be the same as some x% of 10 + y% of 10 + 5. But that makes x and y arbitrary values and they could be anything. So I am not really certain what you are asking for.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    EBITON5 is offline Member
    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Default Re: Please help - calc percent in java

    Thanks for reply ,
    Let me explain please :
    run a search and this code The result is multiplied in this case by 17% (1.17 *)

    I do not want the result will be multipliedbut rather I want result has to be calculated like this:

    X% + Y% + Z $.

    Is it possible? If yes how it will look in the code?

    Thank you!!!

  4. #4
    EBITON5 is offline Member
    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Default Re: Please help - calc percent in java

    Something like this ( but correct :)) :

    if(results[i].getSite()=='Xxx'&&XPrice==0)
    {
    XPrice =(results[i].getPrice() x% + y% + 5$ );
    }
    }

  5. #5
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,910
    Rep Power
    5

    Default Re: Please help - calc percent in java

    Even if you fix the value of Z, the values of X and Y can take on many different values and still get the same result. So either I am not understanding something or you need to provide more information. And the following syntax does not make sense to me.
    Java Code:
    XPrice =(results[i].getPrice() x% + y% + 5$ );
    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Calc GPA II
    By Ibro in forum New To Java
    Replies: 2
    Last Post: 10-03-2013, 03:08 PM
  2. could not find or load main class calc.Calc
    By doomking517 in forum New To Java
    Replies: 5
    Last Post: 06-12-2013, 10:45 PM
  3. need help postfix calc
    By b3222 in forum Advanced Java
    Replies: 1
    Last Post: 03-13-2012, 12:05 AM
  4. How to Open .odf(calc) File using java on Click event of button
    By deshmukh.niraj04 in forum New To Java
    Replies: 14
    Last Post: 03-15-2011, 09:31 AM
  5. Investment Calc
    By rfore1 in forum New To Java
    Replies: 13
    Last Post: 02-28-2010, 07:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •