# M&Ms For this week’s assignment, I tried to find a fun data set.. I ended up finding some random set a professor took of the color distribution in packs of M&Ms. I am trying to use the average number as the radius of a circle in the window to visualize the data, but right now I’m running into a null pointer exception that I’m trying to fix.

```//Colors of milk chocolate M&Ms in the fun size packages
//collected by Todd Swanson and his statistics students in 2001.
//http://www.math.hope.edu/swanson/data/mms.txt

String [][] data;
float brown, red, yellow, blue, green, orange;
MandM brownM, redM, yellowM, blueM, greenM, orangeM;
float colorXpos, colorYpos;
float brownSum, redSum, yellowSum, blueSum, greenSum, orangeSum;
int xPos, yPos;

void setup() {
//the basics
size(640, 280);

data = new String ;
for (int row=0; row < 21; row++) {
String [] temp = new String ;
temp= split(line[row], ',');
for (int column=0; column < 6; column++){
data[row][column]= temp[column];
}
}

//Calculating the sum
for (int row=0; row < 21; row++) {
brownSum += parseInt(data[row]);
redSum += parseInt(data[row]);
yellowSum += parseInt(data[row]);
blueSum += parseInt(data[row]);
greenSum += parseInt(data[row]);
orangeSum += parseInt(data[row]);
}

//To visualize data: average is the radius of ellipse
//Already know there are 21 total rows
brown = brownSum/21;
red = redSum/21;
yellow = yellowSum/21;
blue = blueSum/21;
green = greenSum/21;
orange = orangeSum/21;

for (int i = 0; i < 6; i ++){
brownM =new MandM (random(0,width), random(0,height), brown*15);
redM =new MandM (random(0,width), random(0,height), red*15);
yellowM =new MandM (random(0,width), random(0,height), yellow*15);
blueM =new MandM (random(0,width), random(0,height), blue*15);
greenM =new MandM (random(0,width), random(0,height), green*15);
orangeM =new MandM (random(0,width), random(0,height), orange*15);
}

}

void draw () {
background(255);

MandM [] funSize = new MandM ;
funSize = brownM;
funSize = redM;
funSize = yellowM;
funSize = blueM;
funSize = greenM;
funSize = orangeM;

for (int i=0; i<6; i++){
if (i==0){
fill(110,70,0);

}
if (i==1){
fill(255,0,0);
}
if (i==2){
fill(255,255,0);
}
if (i==3){
fill(0,0,255);
}
if (i==4){
fill(0,255,0);
}
if (i==5){
fill(255,150,0);
}
funSize[i].drawMandM();
}

}

///////
class MandM {

MandM(float x, float y, float radius){
this.xPos = x;
this.yPos = y;

}

void drawMandM(){
for(int i = 0; i < 6; i ++){
noStroke();
smooth();