• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

What is an accumulator

 
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 1847
14
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gary Ba
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Trailboss
Posts: 23216
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
Gary Ba
Ranch Hand
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats a nice, clever trick.

thank you!
    Bookmark Topic Watch Topic
  • New Topic