- Jul 14, 2005
- 29,307
- 106
- 106
Here the goal:
Make a program that takes a .csv file with 10,000 names and randomly assign them to one to one of 6 groups then prints out 6 files 1666 +1 names
So far I have a main class and two sub classes
The first class fileProc takes the given .csv file and makes an ArrayList with 10,000 names
Here is my problem in my 2nd class arrayProc
I have a arraylist of available "buckets" that way if a bucket reaches a 6th of the total input it is removed from the list. The availableBuckets array list hold 6 strings with the name of each available array.
How do I call the array that's name is at availableBuckets.get(#)?
Here is my code if needed:
Thanks!
Make a program that takes a .csv file with 10,000 names and randomly assign them to one to one of 6 groups then prints out 6 files 1666 +1 names
So far I have a main class and two sub classes
The first class fileProc takes the given .csv file and makes an ArrayList with 10,000 names
Here is my problem in my 2nd class arrayProc
I have a arraylist of available "buckets" that way if a bucket reaches a 6th of the total input it is removed from the list. The availableBuckets array list hold 6 strings with the name of each available array.
How do I call the array that's name is at availableBuckets.get(#)?
Here is my code if needed:
Code:
package SortApp;
import java.util.*;
public class arrayProc {
static ArrayList<String> bucket1;
ArrayList<String> bucket2;
ArrayList<String> bucket3;
ArrayList<String> bucket4;
ArrayList<String> bucket5;
ArrayList<String> bucket6;
public static boolean computeArray(ArrayList<String> ArrayProc){
Random randomGenerator = new Random();
boolean complete = false;
int population = ArrayProc.size();
int maxBucketSize = population /6;
ArrayList<String> availableBuckets = new ArrayList <String>();
availableBuckets.add("bucket1");
availableBuckets.add("bucket2");
availableBuckets.add("bucket3");
availableBuckets.add("bucket4");
availableBuckets.add("bucket5");
availableBuckets.add("bucket6");
for (int c=1; c < population;c++){
int rand = randomGenerator.nextInt(availableBuckets.size());
sk.add(rand, ArrayProc.get(c));
}
return complete;
}
}
Thanks!
