aspose file tools*
The moose likes Cattle Drive and the fly likes What is an accumulator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "What is an accumulator" Watch "What is an accumulator" New topic
Author

What is an accumulator

Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 150

I have a question. I have these two local attributes....
int number1 = 0;
int number2 = 2;
Someone asked me to use an accumulator but i am not sure what it means. I tried to look it up but no luck.
I could use an array or int number1, number2.

Does anyone have an opinion about an 'accumulator'?

Thank you,
Garry


star chaser..
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1613
    
  10

Uhmmm.... not sure what the context is.... I haven't heard of an accumulator.....

I wonder if it's like a counter class?

Somewhere near the end of this thread I found out about counter classes.

Also, Google "counter class" java and see if it might work for what you're doing.

I could be totally off base here.


When you do things right, people won't be sure you've done anything at all.
Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 150

It will be nice to use some type of map but i think it is simple enough to eliminate that option.

int something()
{
int number1 = 0;
int number2 = 0;

logic

return number1 and number2;
}

I can't think of something else to use other than an array. hmm
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20271
    ∞

int x = 0;

... do stuff ...

if (too many pancakes)
{
x+= 7;
}

... do stuff ...

x += 2;

... do stuff ...

while (the tide is high)
{
x++;
}


-----


x is an accumulator. It accumulates.





permaculture Wood Burning Stoves 2.0 - 4-DVD set
Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 150

thats a nice, clever trick.

thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is an accumulator
 
Similar Threads
Error message
How to turn a class into an executable file
Applet Troubles
Number calculations
Why use protected???