Help with square root calculator

Hi: I am new to Java. Trying to write code for square root calculator of numbers 1-10. Have no idea where to start.

Using pencil and paper, manually extract the square root of a number, and write down the steps that you use to do that. Create a Java program that does those steps.
A Java Tutorial is here: http://java.sun.com/docs/books/tutorial/

Similar Messages

  • ForLoop Square Root Calculator Program

    * Programmer:      R McBride
    * Date:           November 29, 2006
    * Filename:     SquareRootForLoop.java
    * Purpose:          This program uses for()loops to
    *                    find the square root of a number
    *                    up to four decimal places long.
    import APCS.Keyboard;
    class SquareRootForLoopTest1
         public static void main (String[]args)
              //define variables
              double SquareRoot = 0; //holds initial value
              double num1 = 0;
              boolean done = false;
              double tempReg1 = 0; //holds initial value of i
              double tempReg2 = 0; //holds
              double tempReg3 = 0;
              //while loop start
    //          while (!done)
              //program input
              System.out.println("\t\t\tSQUARE ROOT CALCULATOR PROGRAM");
              System.out.println(""); //skip line
              System.out.println("Enter the number you would like to be square rooted or [0] to end the program.");
              System.out.print("");
              SquareRoot = Keyboard.readInt();
              System.out.println(""); //skip line
              System.out.println("You entered "+SquareRoot+".");
              System.out.println(""); //skip line
              //for loop function
              for(int i = 0; i < 999999; i++)
              tempReg1 = i * i;
              tempReg2 = i;
    //          while (!done)
                        if(tempReg1 == SquareRoot)
                             System.out.println("The square root is "+tempReg2);
                             System.out.println("");
                        else
                             System.out.print("");
              //while loop check to finish
    //          if(SquareRoot == 0)
    //               done = true;
    //          }//end while loop
    }Here is my code for and of you who ever wants to use it. Our assignment was to make a square root calculator using ForLoop (a.k.a. no square root functions).
    My question is, how would I make it increase by .0001 instead of 1 every loop? I need it to do that so I can find square roots of numbers of numbers that have decimals for squares.

    * Programmer:      R McBride
    * Date:           November 29, 2006
    * Filename:     SquareRootForLoop.java
    * Purpose:          This program uses for()loops to
    *                    find the square root of a number
    *                    up to four decimal places long.
    import APCS.Keyboard;
    class SquareRootForLoopTest1
         public static void main (String[]args)
              //define variables
              double SquareRoot = 0; //holds initial value
              double num1 = 0;
              boolean done = false;
              double tempReg1 = 0; //holds initial value of i
              double tempReg2 = 0; //holds
              double tempReg3 = 0;
              //while loop start
    //          while (!done)
              //program input
              System.out.println("\t\t\tSQUARE ROOT CALCULATOR PROGRAM");
              System.out.println(""); //skip line
              System.out.println("Enter the number you would like to be square rooted or [0] to end the program.");
              System.out.print("");
              SquareRoot = Keyboard.readInt();
              System.out.println(""); //skip line
              System.out.println("You entered "+SquareRoot+".");
              System.out.println(""); //skip line
              //for loop function
              for(double i = 0; i < 999999; i+=.0001)
              tempReg1 = i * i;
              tempReg2 = i;
    //          while (!done)
                        if(tempReg1 == SquareRoot)
                             System.out.println("The square root is "+tempReg2);
                             System.out.println("");
                        else
                             System.out.print("");
              //while loop check to finish
    //          if(SquareRoot == 0)
    //               done = true;
    //          }//end while loop
    }Still doesn't work. =[                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • [8i] Need help with some workday calculations

    At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
    Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
    But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
    Note: I'm working with Oracle 8i

    OK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
    CREATE TABLE caln
    (     clndr_dt     DATE          NOT NULL
    ,     clndr_yr     NUMBER
    ,     shop_day     NUMBER
    ,     shop_dt          DATE
    ,     shop_wk          NUMBER
    ,     shop_yr          NUMBER
    ,     shop_days     NUMBER
    ,     clndr_days     NUMBER
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    INSERT INTO     caln
    VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
    INSERT INTO     caln
    VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
    INSERT INTO     caln
    VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
    INSERT INTO     caln
    VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
    INSERT INTO     caln
    VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
    INSERT INTO     caln
    VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
    INSERT INTO     caln
    VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
    INSERT INTO     caln
    VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
    INSERT INTO     caln
    VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
    INSERT INTO     caln
    VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
    INSERT INTO     caln
    VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
    INSERT INTO     caln
    VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
    INSERT INTO     caln
    VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
    INSERT INTO     caln
    VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
    INSERT INTO     caln
    VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
    INSERT INTO     caln
    VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
    INSERT INTO     caln
    VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
    INSERT INTO     caln
    VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
    INSERT INTO     caln
    VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
    INSERT INTO     caln
    VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
    INSERT INTO     caln
    VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
    INSERT INTO     caln
    VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
    INSERT INTO     caln
    VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
    INSERT INTO     caln
    VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
    INSERT INTO     caln
    VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
    INSERT INTO     caln
    VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
    INSERT INTO     caln
    VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
    INSERT INTO     caln
    VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
    INSERT INTO     caln
    VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
    INSERT INTO     caln
    VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
    INSERT INTO     caln
    VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
    INSERT INTO     caln
    VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
    INSERT INTO     caln
    VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
    INSERT INTO     caln
    VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
    INSERT INTO     caln
    VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
    INSERT INTO     caln
    VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
    INSERT INTO     caln
    VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
    INSERT INTO     caln
    VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
    INSERT INTO     caln
    VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
    INSERT INTO     caln
    VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
    INSERT INTO     caln
    VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
    INSERT INTO     caln
    VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
    INSERT INTO     caln
    VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
    INSERT INTO     caln
    VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
    INSERT INTO     caln
    VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
    INSERT INTO     caln
    VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
    INSERT INTO     caln
    VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
    INSERT INTO     caln
    VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
    INSERT INTO     caln
    VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
    INSERT INTO     caln
    VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
    INSERT INTO     caln
    VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
    INSERT INTO     caln
    VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
    CREATE TABLE ords
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     ord_stat     VARCHAR2(2)
    ,     ord_qty          NUMBER
    ,     part_nbr     VARCHAR2(5)
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
    INSERT INTO     ords
    VALUES (1,1,'CL',10,'PART1');
    INSERT INTO     ords
    VALUES (1,2,'CL',5,'PART1');
    INSERT INTO     ords
    VALUES (25,1,'CL',15,'PART2');
    INSERT INTO     ords
    VALUES (14,1,'OP',12,'PART3');
    INSERT INTO     ords
    VALUES (33,1,'CL',25,'PART1');
    INSERT INTO     ords
    VALUES (33,2,'CL',15,'PART1');
    INSERT INTO     ords
    VALUES (33,3,'OP',10,'PART1');
    INSERT INTO     ords
    VALUES (7,1,'PL',18,'PART2');
    INSERT INTO     ords
    VALUES (96,1,'PL',10,'PART3');
    INSERT INTO     ords
    VALUES (31,1,'CL',20,'PART2');
    CREATE TABLE oops
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     op_nbr          VARCHAR2(4)     NOT NULL
    ,     mach_id          VARCHAR2(4)
    ,     oper_stat     VARCHAR2(2)
    ,     plan_start_dt     DATE
    ,     plsu          NUMBER
    ,     plrn          NUMBER
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
    -- NOTE:
    -- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
    -- in more than two operations (though in reality more would be there) since they should be
    -- ignored in the final result anyway
    INSERT INTO     oops
    VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
    INSERT INTO     oops
    VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
    INSERT INTO     oops
    VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
    INSERT INTO     oops
    VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
    INSERT INTO     oops
    VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    CREATE TABLE mach
    (     mach_id          VARCHAR2(4)     NOT NULL
    ,     desc_short     VARCHAR2(9)     
    ,     group          VARCHAR2(7)
         CONSTRAINT ords_pk PRIMARY KEY (mach_id)
    INSERT INTO     mach
    VALUES     ('123A','desc here','GROUPH1');
    INSERT INTO     mach
    VALUES     ('259B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('110C','desc here','GROUPJ1');
    INSERT INTO     mach
    VALUES     ('050C','desc here','GROUPK2');
    INSERT INTO     mach
    VALUES     ('220B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('150G','desc here','GROUPL1');
    INSERT INTO     mach
    VALUES     ('250G','desc here','GROUPL2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');

  • Square root calculation method

    I'm trying to create java code that displays the square root of a number that the user enters, as I am not a great mathematician i cannot work out the logic for this. Any help would be great.
    This is the part of my code that I need assistance with: n1 is the number that the user enters and n2 is where the square root is returned to. I'm guessing that i need to have a loop of some sort to divide n1, but am unsure of the conditions. The n1 is 0 so that after the total is calculated from n1, it is cleared for another number to be entered.
    else if (source == btnSquareRoot)
    n2 = ;
    n1 = 0;
    Please help!

    An adequate method for finding a square root of a number x is this:
    Choose a number that is too low to be the actual square root. (How you do this, I don't know, but zero is pretty small and might be low enough)
    Call that number lo:
    Choose a number that is too high to be the actual square root. (Same comment. well almost. Don't use zero for this - it's too small)
    Call it hi:
    Note, it is easy to check and see that the numbers you have choosen have the required properties. because lo*lo < x and hi*hi > x
    Now you have two candidates for the square root, one of them too low and one of them two high. The actual square root lies somewhere between those two bounds.
    What you want to do now is squeeze those bounds tighter. You do that by choosing a number that is between lo and hi. The mid point would be a nice choice. You may need to figure out how to compute that.
    call that number a:
    well now, either a was itself too low, too high or just right. If it was too low, why replace lo with a and you have just improved the lower bound, if it was too high...
    surely you get the idea.
    Now the question is: How long do you keep this up? Do you ever get the actual square root this way? The answer is: Of course you don't. Most of the time the actual square root requires an infinite number of decimals to represent it. All you are looking for is something that is good enough.
    What does good enough mean? Did you want the number correct to 2 decimal places, to 4 decimals. What do you want? How can you tell if lo and hi are practically the same number?
    If this was a homework problem, that of course goes back to what the teacher wants. If the teacher did not clearly specify, you need to go back and ask what they actually wanted.
    On the other hand if you want to earn a reputations as a smart ass, you figure out some way to detect that the number that you are working on does not have an exact square root and when it does not, you simply print out the message "Sorry - the square root of the number you are looking for cannot be represented in a finite number of digits without resorting to the notation of continued fractions but here it is to 3 decimals..."
    This is the sort of stuff that wins big bonus points with professors.
    On the other hand the way you lose big points with the professors if you say something like that and CAN NOT explain to him what a continued fraction is and explain what you meant by the qualification.
    The other thing that loses big is to cut a chunk of text directly off of a web page and try to fob it off as your own program. Since most professors know how to google, they will stuff some unlikely looking phrase like "notation of continued fractions" and boom they are immediately at this page.
    My point is that if you are going to be a smart ass, you MUST do it carefully or you lose all credibility.
    Sorry for the digression there. Hope this algorithm outline is enough to get you thinking.
    Wow! Killer. I previewed my question and it put asterisks in where I wrote the word, "ass". That is Fucking awesome! They've put in some kind of bad word filter so that when I get fucking abusive with my language and call you a no good shit for brains mother fucker. it cleans it all up for me. That is just too fucking sweet! It sure is a load off of my mind. I guess they just couldn't figure out how to put in !@%#^ which is the way that you actually are supposed to replace vulgarity in the printed word. Oh well, we always knew that this site was maintained by a bunch of **** ***** * **** ***** ** ***** * * *********!

  • Problems with square root approximations with loops program

    i'm having some trouble with this program, this loop stuff is confusing me and i know i'm not doing this correctly at all. the expected values in the tester are not matching up with the output. i have tried many variations of the loop in this code even modifying the i parameter in the loop which i guess is considered bad form. nothing seems to work...
    here is what i have for my solution class:
    /** A class that takes the inputted number by the tester and squares it, and
    *  loops guesses when the nextGuess() method is called. The epsilon value is
    *  also inputted by the user, and when the most recent guess returns a value
    *  <= epsilon, then the hasMoreGuesses() method should return false.
    public class RootApproximator
       /** Takes the inputted values from the tester to construct a RootApproximator.
        * @param val the value of the number to be squared and guessed.
        * @param eps the gap in which the approximation is considered acceptable.
         public RootApproximator(double val, double eps)
              value = val;
              square = Math.sqrt(val);
              epsilon = eps;
       /** Uses the algorithm where 1 is the first initial guess of the
        *  square root of the inputted value. The algorithm is defined by
        *  "If X is a guess for a square root of a number, then the average
        *  of X and value/X is a closer approximation.
        *  @return increasingly closer guesses as the method is continually used.
       public double nextGuess()
             final int TRIES = 10000;
             double guess = 1;
              for (double i = 1; i < TRIES; i++)
                   double temp = value / guess;
                   guess = (guess + temp) / 2.0;
              return guess;
       /** Determines if there are more guesses left if the difference
        *  of the square and current guess are not equal to or less than
        *  epsilon.
        *  @return the value of the condition.
       public boolean hasMoreGuesses()
              return (square - guess <= epsilon);
       private double square;
       private double value;
       private double epsilon;
       private double guess;
    here is the tester:
    public class RootApproximatorTester
       public static void main(String[] args)
          double a = 100;
          double epsilon = 1;
          RootApproximator approx = new RootApproximator(a, epsilon);
          System.out.println(approx.nextGuess());
          System.out.println("Expected: 1");
          System.out.println(approx.nextGuess());
          System.out.println("Expected: 50.5");
          while (approx.hasMoreGuesses())
             approx.nextGuess();
          System.out.println(Math.abs(approx.nextGuess() - 10) < epsilon);
          System.out.println("Expected: true");
    and here is the output:
    10.0
    Expected: 1 // not sure why this should be 1, perhaps because it is the first guess.
    10.0
    Expected: 50.5 // (100 + 1) / 2, average of the inputted value and the first guess.
    true
    Expected: true
    i'm new to java this is my first java course and this stuff is frustrating. i'm really clueless as to what to do next, if anyone could please give me some helpful advice i would really appreciate it. thank you all.

    i'm new to java this is my first java course and this
    stuff is frustrating. i'm really clueless as to what
    to do nextMaybe it's because you don't have a strategy for what the program is supposed to do? To me it looks like a numerical scheme for finding the squareroot of a number.
    Say the number you want to squarerroot is called value and that you have an approximation called guess. How do you determine whether guess is good enought?
    Well in hasMoreGuesses you check whether,
    (abs(value-guess*guess) < epsilon)
    The above decides if guess is within epsilon of being the squareroot of value.
    When you calculate the next guess in nextGuess why do you loop so many times? Aren't you supposed to make just one new guess like,
    guess = (guess + value/guess)/2.0
    The above generates a new guess based on the fact that guess and value/guess must be on each side of value so that the average of them must be closer too value.
    Now you can put the two together to a complete algoritm like,
    while (hasMoreGuesses()) {
       nextGuess();
    }In each iteration of the loop a new "guess" of the squareroot is generated and this continues until the guess is a sufficiently close approximation of the squareroot.

  • Help with PDF Javascript calculation involving checkboxes

    Hello Everyone,
    I have a PDF Form, and need help with a calculation.
    For the sake of simplicity, Lets say I have 5 fields. FSA1 and FSA2 are checkboxes. TotalClaimed1 and TotalClaimed2 are text fields which allow only a numerical input.
    The last box, FSA_Total, should add the value from TotalClaimed1 if FSA1 is checked, and it should also add the value from TotalClaimed2 if FSA2 is checked.
    The code is malfunctioning, however. Something is causing it to add to the total every time the box is checked. Its almost like the checking off of the box is what causes the addition.
    It seems like the code is being read as "When the box is checked, add the value to the total", so each time the box gets checked, it adds to the total again.
    and it should be "IF the box is checked, add the value to the total" so if there is a value in the field, and the box is checked, that value is passed on to the total; and if the box is not checked, the value is ignored.
    Can anyone spot what might be causing this? Code is below.
    var claim1 = parseInt(this.getField('TotalClaimed1').value),
        claim2 = parseInt(this.getField('TotalClaimed2').value),
        fsabox = parseInt(this.getField('FSA_Total').value);
    if (this.getField('FSA1').value == 'Yes') {
        fsabox += claim1;
    if (this.getField('FSA2').value == 'Yes') {
        fsabox += claim2;
    event.value = fsabox;
    Thanks
    Thisguy1234

    This is a custom calculation script for FSA_Total, correct? The code is working correctly, it's just not what you want. Assuming this is a custom calculation script in the FSA_Total field, it should be something like:
    var sum = 0;
    var claim1 = parseInt(getField('TotalClaimed1').value, 10),
        claim2 = parseInt(getField('TotalClaimed2').value, 10),
    // Add field values if corresponding check boxes are selected
    if (getField('FSA1').value !== "Off") {
        sum += claim1;
    if (getField('FSA2').value !== "Off") {
        sum += claim2;
    // Set this field value
    event.value = sum;
    Why are you using parseInt, exactly?

  • Please help with customizing price calculation in CRM 7 !!!

    Hi, Experts!
    I have a problem with customizing price calculation for product. Product is a bank's credit. I want to fill credit's data (percentage rate, pay term, monthly comission and other conditions) in condition record and after pricing procedure done i could saw results in WebUI (monthly fee, total rpice of product and etc.). 1) How to do that? Can i change or insert some fields (i mean columns) in product area (for example when i want to create opportunity)? 2) How can i change or insert calculation rule? 3) Can i insert formula in calsulation? Help me please step by step.
    Thank for your help.
    Regards,
    faraviper.

    Hello Faraviper
    I think you have not installed PME component correctly. Please use the following path to see the help documentation for that.
    http://service.sap.com/crm-inst
    or
    http://service.sap.com/instguides
    Also check out this OSS note, though it is for an older release it may throw some important pointers.
    857969 - Installing PME for CRM 5.0
    Hope this helps.

  • Need help with my graphic calculator!!!

    Hello everybody!! I need help with my little program I made.... The problem is that I am unable to use to calculate but it is possible to compile the code!! What should I do?? Thanks in advance.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Aritmetik extends JFrame implements ActionListener{
         private JLabel l1 = new JLabel("Tal1: ", JLabel.LEFT);
         private JLabel l2 = new JLabel("Tal2: ", JLabel.LEFT);
         private JLabel l3 = new JLabel("Resultat",JLabel.LEFT);
         private JLabel l4 = new JLabel(" ", JLabel.RIGHT);
         private JTextField t1 = new JTextField(" ",10);
         private JTextField t2 = new JTextField(" ",10);
         private JButton b1 = new JButton("+");
         private JButton b2 = new JButton("-");
         private JButton b3 = new JButton("*");
         private JButton b4 = new JButton("/");
         public Aritmetik(){
              Container v = getContentPane();
              v.setLayout(new GridLayout(5,2));
              v.add(l1);
              v.add(t1);
              v.add(l2);
              v.add(t2);
              v.add(b1);
              v.add(b2);
              v.add(b3);
              v.add(b4);
              v.add(l3);
              v.add(l4);
              b1.addActionListener(this);
              b2.addActionListener(this);
              b3.addActionListener(this);
              b4.addActionListener(this);
              pack();
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public void actionPerformed(ActionEvent e){
              int tal1 = Integer.parseInt(t1.getText());
              int tal2 = Integer.parseInt(t2.getText());
                   if(e.getSource() == b1){
              if(t1.getText().equals("") || t2.getText().equals(""))
                                       JOptionPane.showMessageDialog(null, "Mata in tal!");
                   else{
                        l3.setText("Resultat ");
                   l4.setText(" " + (tal1+tal2));
                   else if(e.getSource() == b2){
                        int sub = tal1-tal2;
                        l4.setText(" " + (sub));
                   else if(e.getSource() == b3){
                        int multi = tal1*tal2;
                        l4.setText(" " + (multi));
                   else if(e.getSource() == b4){
                        int div = tal1/tal2;
                        l4.setText(" " + (div));
                   public static void main(String[] arg){
                   Aritmetik A =new Aritmetik();

    Here is your problem:
    public void actionPerformed(ActionEvent e){
      int tal1 = Integer.parseInt(t1.getText().trim());  // add the trim()
      int tal2 = Integer.parseInt(t2.getText().trim());  // add the trim()
      if(e.getSource() == b1){
        if(t1.getText().equals("") || t2.getText().equals(""))
          JOptionPane.showMessageDialog(null, "Mata in tal!");
        else{
          l3.setText("Resultat ");
          l4.setText(" " + (tal1+tal2));
      }... Better ...
    public void actionPerformed(ActionEvent e)  throws NumberFormatException {
      String tala = t1.getText().trim();
      String talb = t2.getText().trim();
      if ( tala == null  ||  "".equals(tala)  ||  talb == null  ||  "".equals(talb) ) {
        JOptionPane.showMessageDialog(null, "Mata in tal!");
        return();
      int tal1 = Integer.parseInt(tala);
      int tal2 = Integer.parseInt(talb);
      if(e.getSource() == b1){
        l3.setText("Resultat ");
        l4.setText(" " + (tal1+tal2));
      else if(e.getSource() == b2){
        int sub = tal1-tal2;
        l4.setText(" " + (sub));
      else if(e.getSource() == b3){
        int multi = tal1*tal2;
        l4.setText(" " + (multi));
      else if(e.getSource() == b4){
        int div = tal1/tal2;
        l4.setText(" " + (div));
    }Message was edited by:
    abillconsl

  • I need help with this program ( Calculating Pi using random numbers)

    hi
    please understand that I am not trying to ask anymore to do this hw for me. I am new to java and working on the assignment. below is the specification of this program:
    Calculate PI using Random Numbers
    In geometry the ratio of the circumference of a circle to its diameter is known as �. The value of � can be estimated from an infinite series of the form:
    � / 4 = 1 - (1/3) + (1/5) - (1/7) + (1/9) - (1/11) + ...
    There is another novel approach to calculate �. Imagine that you have a dart board that is 2 units square. It inscribes a circle of unit radius. The center of the circle coincides with the center of the square. Now imagine that you throw darts at that dart board randomly. Then the ratio of the number of darts that fall within the circle to the total number of darts thrown is the same as the ratio of the area of the circle to the area of the square dart board. The area of a circle with unit radius is just � square unit. The area of the dart board is 4 square units. The ratio of the area of the circle to the area of the square is � / 4.
    To simuluate the throwing of darts we will use a random number generator. The Math class has a random() method that can be used. This method returns random numbers between 0.0 (inclusive) to 1.0 (exclusive). There is an even better random number generator that is provided the Random class. We will first create a Random object called randomGen. This random number generator needs a seed to get started. We will read the time from the System clock and use that as our seed.
    Random randomGen = new Random ( System.currentTimeMillis() );
    Imagine that the square dart board has a coordinate system attached to it. The upper right corner has coordinates ( 1.0, 1.0) and the lower left corner has coordinates ( -1.0, -1.0 ). It has sides that are 2 units long and its center (as well as the center of the inscribed circle) is at the origin.
    A random point inside the dart board can be specified by its x and y coordinates. These values are generated using the random number generator. There is a method nextDouble() that will return a double between 0.0 (inclusive) and 1.0 (exclusive). But we need random numbers between -1.0 and +1.0. The way we achieve that is:
    double xPos = (randomGen.nextDouble()) * 2 - 1.0;
    double yPos = (randomGen.nextDouble()) * 2 - 1.0;
    To determine if a point is inside the circle its distance from the center of the circle must be less than the radius of the circle. The distance of a point with coordinates ( xPos, yPos ) from the center is Math.sqrt ( xPos * xPos + yPos * yPos ). The radius of the circle is 1 unit.
    The class that you will be writing will be called CalculatePI. It will have the following structure:
    import java.util.*;
    public class CalculatePI
    public static boolean isInside ( double xPos, double yPos )
    public static double computePI ( int numThrows )
    public static void main ( String[] args )
    In your method main() you want to experiment and see if the accuracy of PI increases with the number of throws on the dartboard. You will compare your result with the value given by Math.PI. The quantity Difference in the output is your calculated value of PI minus Math.PI. Use the following number of throws to run your experiment - 100, 1000, 10,000, and 100,000. You will call the method computePI() with these numbers as input parameters. Your output will be of the following form:
    Computation of PI using Random Numbers
    Number of throws = 100, Computed PI = ..., Difference = ...
    Number of throws = 1000, Computed PI = ..., Difference = ...
    Number of throws = 10000, Computed PI = ..., Difference = ...
    Number of throws = 100000, Computed PI = ..., Difference = ...
    * Difference = Computed PI - Math.PI
    In the method computePI() you will simulate the throw of a dart by generating random numbers for the x and y coordinates. You will call the method isInside() to determine if the point is inside the circle or not. This you will do as many times as specified by the number of throws. You will keep a count of the number of times a dart landed inside the circle. That figure divided by the total number of throws is the ratio � / 4. The method computePI() will return the computed value of PI.
    and below is what i have so far:
    import java.util.*;
    public class CalculatePI
      public static boolean isInside ( double xPos, double yPos )
         double distance = Math.sqrt( xPos * xPos + yPos * yPos );        
      public static double computePI ( int numThrows )
        Random randomGen = new Random ( System.currentTimeMillis() );
        double xPos = (randomGen.nextDouble()) * 2 - 1.0;
        double yPos = (randomGen.nextDouble()) * 2 - 1.0;
        int hits = 0;
        int darts = 0;
        int i = 0;
        int areaSquare = 4 ;
        while (i <= numThrows)
            if (distance< 1)
                hits = hits + 1;
            if (distance <= areaSquare)
                darts = darts + 1;
            double PI = 4 * ( hits / darts );       
            i = i+1;
      public static void main ( String[] args )
        Scanner sc = new Scanner (System.in);
        System.out.print ("Enter number of throws:");
        int numThrows = sc.nextInt();
        double Difference = PI - Math.PI;
        System.out.println ("Number of throws = " + numThrows + ", Computed PI = " + PI + ", Difference = " + difference );       
    }when I tried to compile it says "cannot find variable 'distance' " in the while loop. but i thought i already declare that variable in the above method. Please give me some ideas to solve this problem and please check my program to see if there is any other mistakes.
    Thanks a lot.

    You've declared a local variable, distance, in the method isInside(). The scope of this variable is limited to the method in which it is declared. There is no declaration for distance in computePI() and that is why the compiler gives you an error.
    I won't check your entire program but I did notice that isInside() is declared to be a boolean method but doesn't return anything, let alone a boolean value. In fact, it doesn't even compute a boolean value.

  • Need help with crazy custom calculations code in Acrobat XI pro

    Im trying to calculate some text feilds together and just cant figure it out.  I have two text feild boxes that I would input certain numbers to calculate in, Textfeild D5 and D6,  once the user supplies the numbers in the D5 and D6   I need a text feild (D9) to calculate and produce a number thats used in another calculation. Any help would be greatly appriciated. Im good at HTML and CSS but only begining with javascript. Im using acrobat XI pro and I put this code in the custom javascript area within the text feld "D9" properties.
    var Dsix = +getField("D6").value;
    var Dfive = +getFeild("D5").value;
    var B2 = 0.37;
    var B3 = 0.45;
    var B4 = 0.53;
    if (Dsix = 15){
    D9.value = B2*Dfive;
    if (Dsix = 30){
    D9.value = B3*Dfive;
    if (Dsix = 45){
    D9.value = B4*Dfive;

    Well thats makes since but unfortunitly it didnt work. The green text feild D9 is where im placing code at. they will be hiiden feilds. the red outlined text feilds are all input feilds. seconds is D6 and nozzels is D5.

  • Help with Risk Rating calculation

    I'm trying to understand the risk rating calculation on an IPS4240 sensor.  From what I can tell, it looks like there are some additional parameters added to the equation that are not easy to determine.  It looks like the ARR (Attack Relevancy Rating) and/or WLR (Watch List Rating) are making changes (i.e. being added to the RR), but I cannot find any values for these.  Are there default values for ARR that the system uses?  What about the WLR, can that be viewed anywhere?
    Any help is appreciated.
    Thanks,
    Pat

    Hi Pat,
    I guess below is what you are looking for:
    http://www.cisco.com/web/about/security/intelligence/ipsmit.html
    It says the below:
    "Attack Relevancy Rating: The Attack Relevancy Rating  (ARR) is an IPS-generated value that  indicates if the attack target may  be vulnerable to an event-specific attack.  This information is  normally gathered through passive operating system identification but  can also be defined by a  user or gathered through integration with the  Cisco Security Agent Management  Console. If the operating system of the  targeted device is  unknown, there is no change to the  risk rating.  However, if the  targeted device operating system is discovered to be  relevant, the risk rating  increases by 10 in both Inline and  Promiscuous modes. If the targeted device operating system is found  to  be irrelevant, the risk rating in Promiscuous mode is reduced by  10,  and no change occurs in Inline mode."
    Let me know if this clears things up.
    Thanks and Regards,
    Prapanch

  • Need help with a form calculation

    I am trying to create a form in Acrobat that will support a calculation of percentages. I have the
    following formula:
    if (a1.value == "" || a1.value == "" && b1.value == "") {c1=0} else {b1/a1}
    The percentage is not calculating and is remaining at 0% when numbers are entered on the form. I am trying to avoid the error messages we receive if we just enter the basic calculation in to the simplified (because some of the cells may have a value of 0).
    Can anyone help?

    Try this:
    // Get the field values
    var v1 = getField("a1").value;
    var v2 = getField("b1").value;
    //. Perform the calculation
    if (v1) {
        event.value = v2 / v1;
    } else {
        event.value = 0;
    Edit: corrected typo

  • Help with PDF Form Calculation

    OK So I don't know if this is even possible but what I am wanting is for clients to enter their income in the "income" felid and then for the "contribution" felid to pre-populate with how much they can have contributed...
    if the value is less than $31,920 then it is equal to $1000 – which works
    if the value is more than $61,920 then it is equal to $0 – which also works
    if the value is between $31,920 and $61,920 to apply the following formula:
    1000-(0.0333*(income-31920))  - this is where I am stumped!
    I have used the following code which works for the lesser than / greater than queries... however when I ask it to actually take the value in the box and use it to make a calculation I have no idea where to begin (or even if it is possible) so (as you can probably tell) I have just made up some sort of code which clearly doesn’t work...
    if (this.getField("income").value<31920) {
      event.value = 1000
      } else {
        if (this.getField("income").value>61920) {
        event.value = 0
      } else {
          event.value = 1000-(0.03333*((this.getFeild("income"))-31920))
    Any takers?

    You were very close. Try something like the following as the calculated field's custom Calculate script:
    (function () {
        // Get the field value
        var v = getField("income").value;
        if (v < 31920) {
            event.value = 1000;
            return;
        if (v > 61920) {
            event.value = 0;
            return;
        // v is >= 31920 and =< 61920
        event.value = 1000 - (0.03333 * (v - 31920));

  • MS Project 2007 - Help with custom field calculation for grouped by dates view

    Hello 
    I am trying to creat a view that counts number of students in courses (while # Students is a custom field that is filled manually and courses are tasks).
    The view should be grouped by Quarters, Months, and weeks (Calculated custom Text fields)
    The weeks groups are displayed by the start day of each week.
    For example:
    The view counts how many students are in courses in a specific week/month/quarter.
    This is the group by definition:
    Those are the fields calculations:
    “WW_Start” field calculation:
    (Year([Start]) & "  W " & Format([Start],"WW") & " " & "   [" & Datevalue(ProjDateSub([Start],CStr(Weekday([Start])-1),"Standard")) & "]")
    “MM” field calculation:
    Year([Start]) & "  M " & Format([Start],"MM")
    Basically it works but it doesn't cover a situation where a course is more then a week.  
    Lets say that the duration of the task is 12 days, the task should appear on 3 different weeks groups.
    But what i did puts the tasks only in the group that shows the first week of the task.
    How can i change my calculations or my view so that in the second, and third week of the task it will also show the task and it's attributes.
    For example:
     - "UV5 ACM" task should also be in W 45 not just W 44.
    Anyone has an idea how to do that?
    Ofir Marco , MCTS P.Z. Projects

    Hi
    First, thanks for the comment "nice neat groups" :)
    I think you understood correctly what is my issue.
    Second, about your question:  the class have the same number of students during the course period.
    It will have 10 students even if the duration is 1 day or 10 days.
    if you look at the basic gantt chart you will see a row like this:
    Task name        Duration        Num_Students     Resource names (Instructors)
    Course YYY       10d                10                       
    Instructor X
    it is an attribute on the task, not the assiment.
    When i group by dates (Weeks, months, quarters) or by another field (can be course type for example) i the students are summed in the task summary level for all tasks.
    Lets say i group by all the tasks (Classes) that are in the 1st quarter, and lets say for the example that there are 3:
    Task 1 -->  5 students
    Task 2 --> 10 students
    Task 3 --> 7 students
    Then, the group by summary should count:
    Quarter 1 - 2014:   22 (students)
    Task 1 --> 5
    Task 2 --> 10
    Task 3 --> 7
    By the way, it doesn't matter if the version is project 2007,2010, 2013, the logic is the same.
    Hope it helps and i'll be glad to have some ideas or evan get examples for solution in a project file by e-mail.
    Ofir Marco , MCTS P.Z. Projects

  • Need help with Report Script calculation...

    When trying to implement a calculation on 2 members (sales, tax exempt) I am having a problem keeping the report from accumulating the calculation total...
    Any ideas would certainly be appreciated.
    Thanks,
    //*****Script******
    { CALCULATE ROW  "item1" OFF}     //sets variable for first calculation item
    { CALCULATE ROW  "item2" OFF}     //sets variable for second calculation item
    <row("entities", "Measures")
    //{Supoutput}
    {SETROWOP "item1" +}     //starts adding the member
    "Sales"
    {SETROWOP "item1" OFF}     //stops adding the member
    {SETROWOP "item2" +}          //starts adding the member
    "tax exempt"
    {SETROWOP "item2" OFF}     //stops adding the member
    //{OUTPUT}
    { CALCULATE ROW  "total sales" = "item1" - "item2"
    PRINTROW "total sales"}
    //*****what I am expecting******
    north      sales     777.00
    north      tax exempt     27.00
    north      total sales     750.00
    south      sales     796.00
    south      tax exempt     23.00
    south      total sales     773.00     <======     correct
    //******actualreport results******
    north     sales     777.00
    north      tax exempt     27.00
    north      total sales     750.00
    south     sales     796.00
    south      tax exempt     23.00
    south      total sales     1523.00     <==== accumulated number / wrong!
    Edited by: Adam M on Sep 29, 2011 5:06 PM

    You should do this calculation in Essbase, not in report script. Add dynamic calc member "Total Sales" with formula "Sales" - "Tax Exempt"...
    Regards,
    Yuri

Maybe you are looking for