Accumulate 1.0

R

Roedy Green

Accumulate Version 1.0

Accumulate amounts by category

Class library used to accumulate values by category.
It might be useful for example in a billing program
to accumulate hours by various categories.

It could be used to count how many times various words
occurred in a document.

All you need to is say:

buckets.accumulate( "somecategory", someamount );

And Accumulate looks after creating the buckets to
accumulate new categories for you.

e.g.

Accumulate buckets = new Accumulate( 20 );
buckets.accumulate( "ugli fruit", 3 );
buckets.accumulate( "peaches", 10 );
buckets.accumulate( "strawberries", 15 );
buckets.accumulate( "peaches", 14 );
String[] categories = buckets.categories();

// prints:
// peaches:24
// strawberries:15
// ugli fruit:3
for ( int i=0; i<categories.length; i++ )
{
System.out.println( categories
+ ":"
+ buckets.total( categories ));
}

Freeware copyright 2004 Canadian Mind Products.
May be used freely for any purpose but military.
All Java source code is included.
download from http://mindprod.com/products.html#ACCUMULATE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top